From fd55167a210f949e37fdafb4a4915d178557dc7f Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 4 Dec 2025 13:41:50 +0530 Subject: [PATCH] GWM : cors changes --- server.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 3acad06..408ee33 100644 --- a/server.js +++ b/server.js @@ -28,7 +28,20 @@ app.use(cors({ credentials: true })); app.use((req, res, next) => { + res.header("Access-Control-Allow-Origin", req.headers.origin); res.header("Access-Control-Allow-Credentials", "true"); + res.header( + "Access-Control-Allow-Headers", + "Content-Type, Authorization, APP_SIGNATURE, x-app-signature" + ); + res.header( + "Access-Control-Allow-Methods", + "GET, POST, PUT, PATCH, DELETE, OPTIONS" + ); + + if (req.method === "OPTIONS") { + return res.sendStatus(200); + } next(); }); @@ -122,9 +135,6 @@ app.post("/deploy", deploymentController.deployment); // console.log("✅ Database connected & synced."); // }); - - - // Start server const PORT = process.env.PORT || 5000; app.listen(PORT, () => {