Add setting to force redirect http to https
This commit is contained in:
parent
5f6d36d05b
commit
4785ade1e2
|
@ -56,6 +56,15 @@ function Server () {
|
||||||
this.server.use('/.well-known', express.static(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) => {
|
this.server.get('/', (req, res) => {
|
||||||
const html = this.generateHomePage(req);
|
const html = this.generateHomePage(req);
|
||||||
if (html) {
|
if (html) {
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
"hideVisitors": false,
|
"hideVisitors": false,
|
||||||
"sslPrivateKey": null,
|
"sslPrivateKey": null,
|
||||||
"sslCertificate": null,
|
"sslCertificate": null,
|
||||||
"sslCertificateAuthority": null
|
"sslCertificateAuthority": null,
|
||||||
|
"forceHTTPS": false
|
||||||
}
|
}
|
Loading…
Reference in New Issue