1
0
mirror of https://github.com/dap-ps/discover.git synced 2025-01-31 11:35:18 +00:00

add a redirect to https for production

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-31 10:47:24 -04:00
parent 8620df672d
commit 4f876d5a96
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020

View File

@ -8,6 +8,15 @@ class APIRouter {
/* for ElasticBeanstalk Load Balancer healthcheck */ /* for ElasticBeanstalk Load Balancer healthcheck */
app.use('/healthcheck', async (req, res) => res.send('OK')) app.use('/healthcheck', async (req, res) => res.send('OK'))
/* redirect if not on https on prod */
app.use(async (req, res, next) => {
if (req.get('x-forwarded-proto') == 'http') {
res.redirect('https://' + req.headers.host + req.url);
} else {
next()
}
});
} }
} }