From 3784e55c91063751d0b01971a4cfa4fcf1708460 Mon Sep 17 00:00:00 2001 From: bourgeoa Date: Sun, 28 Jan 2024 13:52:48 +0100 Subject: [PATCH] redirect http --- lib/create-app.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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))