From b8993aad4bb23887552216b8c6640615aa8523b5 Mon Sep 17 00:00:00 2001 From: soleil00 Date: Fri, 31 May 2024 14:17:50 +0200 Subject: [PATCH] extended cors for whole application --- src/utils/server.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/server.ts b/src/utils/server.ts index c9fad23..1561f0c 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -51,7 +51,13 @@ app.use(express.urlencoded({ extended: true })); app.use( cors({ - origin:env.client_url, + origin: (origin, callback) => { + if (!origin || allowedOrigins.includes(origin)) { + callback(null, true); + } else { + callback(new Error("Not allowed by CORS")); + } + }, }), );