From c9c5bd415345548452f15691b2519aaf8de250a6 Mon Sep 17 00:00:00 2001 From: liangyuanruo Date: Wed, 9 Sep 2020 11:05:26 +0800 Subject: [PATCH] refactor(proxy): do not override X-Forwarded-Proto headers --- src/loaders/express/index.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/loaders/express/index.ts b/src/loaders/express/index.ts index 38b517e1c3..cf71cb02ae 100644 --- a/src/loaders/express/index.ts +++ b/src/loaders/express/index.ts @@ -29,13 +29,8 @@ const loadExpressApp = async (connection: Connection) => { const environmentConfigs = { production(app: Express) { - // Add x-forwarded-proto headers to handle https cookie, - // and trust the proxy that is in front of you - app.use(function (req, res, next) { - req.headers['x-forwarded-proto'] = 'https' - return next() - }) - app.set('trust proxy', 1) + // Trust the load balancer that is in front of the server + app.set('trust proxy', true) return app }, }