diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx index 50b86120f8..f9212ed469 100644 --- a/apps/web/pages/auth/login.tsx +++ b/apps/web/pages/auth/login.tsx @@ -58,8 +58,12 @@ export default function Login({ const telemetry = useTelemetry(); - const callbackUrl = - typeof router.query?.callbackUrl === "string" ? `${WEBSITE_URL}/${router.query.callbackUrl}` : "/"; + let callbackUrl = typeof router.query?.callbackUrl === "string" ? router.query.callbackUrl : "/"; + + // If not absolute URL, make it absolute + if (!/^https?:\/\//.test(callbackUrl)) { + callbackUrl = `${WEBSITE_URL}/${callbackUrl}`; + } const LoginFooter = (