mirror of https://github.com/dap-ps/discover.git
Merge pull request #24 from dap-ps/add-https-redirect
add a redirect to https for production
This commit is contained in:
commit
653f4758ff
|
@ -8,6 +8,15 @@ class APIRouter {
|
|||
|
||||
/* for ElasticBeanstalk Load Balancer healthcheck */
|
||||
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()
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue