From 89f86e2c8484540dd92ba73bbeebdb81937e64ec Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Wed, 9 Mar 2022 20:17:02 +0530 Subject: [PATCH] fix redirection to 404 page on login (#2086) Co-authored-by: Peer Richelsen --- apps/web/pages/auth/login.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 = (