Add setting to force redirect http to https
This commit is contained in:
parent
5f6d36d05b
commit
4785ade1e2
|
@ -55,6 +55,15 @@ function Server () {
|
|||
if (fs.existsSync(path.resolve('./.well-known'))) {
|
||||
this.server.use('/.well-known', express.static(path.resolve('./.well-known')));
|
||||
}
|
||||
|
||||
if (this.https && settings.forceHTTPS) {
|
||||
this.server.use(function (req, res, next) {
|
||||
if (!req.secure) {
|
||||
return res.redirect(['https://', req.get('Host'), req.baseUrl].join(''));
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
this.server.get('/', (req, res) => {
|
||||
const html = this.generateHomePage(req);
|
||||
|
|
|
@ -12,5 +12,6 @@
|
|||
"hideVisitors": false,
|
||||
"sslPrivateKey": null,
|
||||
"sslCertificate": null,
|
||||
"sslCertificateAuthority": null
|
||||
"sslCertificateAuthority": null,
|
||||
"forceHTTPS": false
|
||||
}
|
Loading…
Reference in New Issue