diff --git a/frontend/app/auth/callback/route.ts b/frontend/app/auth/callback/route.ts index c6adec29..8c48ac1c 100644 --- a/frontend/app/auth/callback/route.ts +++ b/frontend/app/auth/callback/route.ts @@ -27,9 +27,8 @@ export async function GET(request: NextRequest) { } const nextPath = normalizeNextPath(request.nextUrl.searchParams.get("next")); - const redirectUrl = request.nextUrl.clone(); - redirectUrl.pathname = nextPath; - redirectUrl.search = ""; + const baseUrl = siteUrl || request.nextUrl.origin; + const redirectUrl = new URL(nextPath, baseUrl); if (!hasSupabaseServerEnv()) { return NextResponse.redirect(redirectUrl);