diff --git a/lib/create-app.js b/lib/create-app.js index 9796366a..c19fcc4c 100644 --- a/lib/create-app.js +++ b/lib/create-app.js @@ -115,6 +115,14 @@ function createApp (argv = {}) { authProxy(app, argv.authProxy) } + // redirect http to https + app.use(function (req, res, next) { + if (req.protocol === 'http:') { + return res.redirect('https://' + req.headers.host + req.url) + } + next() + }) + // Attach the LDP middleware app.use('/', LdpMiddleware(corsSettings))