From 22a9202e7b7f195f95c2c6904d44b5901f5375e4 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Thu, 15 May 2025 09:21:51 +0000 Subject: [PATCH] Merged in feat/redirect-add-logging (pull request #2105) feat: add scandic-redirect logging * feat: add scandic-redirect logging Approved-by: Michael Zetterberg --- apps/scandic-redirect/netlify/functions/redirect.mts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/scandic-redirect/netlify/functions/redirect.mts b/apps/scandic-redirect/netlify/functions/redirect.mts index 139fdee08..160202846 100644 --- a/apps/scandic-redirect/netlify/functions/redirect.mts +++ b/apps/scandic-redirect/netlify/functions/redirect.mts @@ -52,11 +52,18 @@ export default async (req: Request) => { ? redirectUrl.slice(0, -1) : redirectUrl; if (redirectUrlWithoutTrailingSlash === body.pathname) { + console.log( + `[scandic-redirect] recieved ${body.pathname}, found ${redirectUrlWithoutTrailingSlash}, no-op` + ); return new Response("Not Found", { status: 404 }); } + console.log( + `[scandic-redirect] recieved ${body.pathname}, return ${redirectUrlWithoutTrailingSlash}, success` + ); return new Response(redirectUrlWithoutTrailingSlash); } } + console.log(`[scandic-redirect] recieved ${body.pathname}, not found`); return new Response("Not Found", { status: 404 }); } catch (error) { return new Response("Bad request", { status: 400 });