Skip to content

Commit 3784e55

Browse files
committed
redirect http
1 parent 59f94fb commit 3784e55

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/create-app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ function createApp (argv = {}) {
115115
authProxy(app, argv.authProxy)
116116
}
117117

118+
// redirect http to https
119+
app.use(function (req, res, next) {
120+
if (req.protocol === 'http:') {
121+
return res.redirect('https://' + req.headers.host + req.url)
122+
}
123+
next()
124+
})
125+
118126
// Attach the LDP middleware
119127
app.use('/', LdpMiddleware(corsSettings))
120128

0 commit comments

Comments
 (0)