diff --git a/app/api/[...slug]/route.ts b/app/api/[...slug]/route.ts index 43e9ea4..aadec6b 100644 --- a/app/api/[...slug]/route.ts +++ b/app/api/[...slug]/route.ts @@ -7,20 +7,20 @@ async function handler( { params }: { params: Promise<{ slug: string[] }> } ) { const { slug } = await params; - const path = '/api/' + slug.join('/'); + const slugPath = slug.join('/'); + + // Auth routes go directly without /api/ prefix + const isAuth = slugPath.startsWith('auth/'); + const path = isAuth ? `/${slugPath}` : `/api/${slugPath}`; + const url = `${API_BASE}${path}${request.nextUrl.search}`; const headers = new Headers(); - - // Forward content-type exactly (includes multipart boundary) const contentType = request.headers.get('content-type'); if (contentType) headers.set('content-type', contentType); - - // Forward session cookie const cookie = request.headers.get('cookie'); if (cookie) headers.set('cookie', cookie); - // Forward body let body: BodyInit | undefined; if (request.method !== 'GET' && request.method !== 'HEAD') { body = await request.arrayBuffer();