mirror of
https://github.com/dap-ps/discover.git
synced 2025-02-07 06:54:49 +00:00
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…
x
Reference in New Issue
Block a user