From 42db4e162ee0c4c582db7c3f61f47e21ace869d6 Mon Sep 17 00:00:00 2001 From: m-breitbach <44359158+m-breitbach@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:11:11 +0100 Subject: [PATCH] Add implicit default origin in case of port 80 --- server/src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/index.ts b/server/src/index.ts index 88954ebc5..3941ab820 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -170,10 +170,12 @@ const originValidationMiddleware = ( // Default origins based on CLIENT_PORT or use environment variable const clientPort = process.env.CLIENT_PORT || "6274"; - const defaultOrigin = `http://localhost:${clientPort}`; - const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(",") || [ - defaultOrigin, - ]; + const defaultOrigins = [`http://localhost:${clientPort}`]; + if (clientPort === "80") { + defaultOrigins.push("http://localhost"); + } + const allowedOrigins = + process.env.ALLOWED_ORIGINS?.split(",") || defaultOrigins; if (origin && !allowedOrigins.includes(origin)) { console.error(`Invalid origin: ${origin}`);