From 6cca03602c4c9bd9eabee7a2b2f24f53cc73e921 Mon Sep 17 00:00:00 2001 From: sg108 Date: Fri, 12 May 2023 14:22:26 +0530 Subject: [PATCH] try2 --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f7a9bdd..d3a0152 100644 --- a/index.js +++ b/index.js @@ -14,13 +14,20 @@ const orderRoute = require("./routes/order") const paymentRoute = require("./routes/payment") const cors = require("cors") - +app.set('trust proxy', 1); app.use(cors({ origin:'https://homekart.azurewebsites.net', credentials:true })) app.use(express.json()) + +app.use(function(req, res, next) { + if(req.headers['x-arr-ssl'] && !req.headers['x-forwarded-proto']) { + req.headers['x-forwarded-proto'] = 'https'; + } + return next(); +}); mongoose .connect(process.env.MONGO_URL) .then(() => console.log("Database Connected"))