From 06ec81bae93a268f36f2ef437266fb36b71c21b0 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 4 Dec 2025 14:52:12 +0530 Subject: [PATCH] GWM : helmet --- server.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 8a1f48a..56cd042 100644 --- a/server.js +++ b/server.js @@ -26,16 +26,19 @@ app.use(sanitizeInput); // app.use(cors()); const allowedOrigins = [ - "http://localhost:5173/", //local - "http://13.201.47.205:5173/", //dev - "http://13.201.47.205:5175/" //uat + "http://localhost:5173", //local + "http://13.201.47.205:5173", //dev + "http://13.201.47.205:5175", //uat + "https://ipi.venbait.in/api" ]; app.use(cors({ origin: allowedOrigins, credentials: true })); app.use((req, res, next) => { - res.header("Access-Control-Allow-Origin", req.headers.origin); + if (allowedOrigins.includes(req.headers.origin)) { + res.header("Access-Control-Allow-Origin", req.headers.origin); + } res.header("Access-Control-Allow-Credentials", "true"); res.header( "Access-Control-Allow-Headers",