fix magic link

This commit is contained in:
Ola Malmgren
2026-05-22 23:20:45 +02:00
parent 23fd84d85c
commit a03d1e8541

View File

@@ -11,5 +11,9 @@ export async function GET(req: Request) {
const target = email
? `${prefix}/min-sida/oversikt`
: `${prefix}/min-sida/verifiera`;
return NextResponse.redirect(new URL(target, url.origin));
// Use the configured public origin — req.url.origin is the internal
// container host (e.g. http://<hash>:3000) when behind Traefik.
const base =
process.env.NEXT_PUBLIC_SITE_URL ?? process.env.AUTH_URL ?? url.origin;
return NextResponse.redirect(new URL(target, base));
}