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",