mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
updated protocol enforcing
This commit is contained in:
@@ -8,10 +8,9 @@ router.use(function(req, res, next) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.route('/:channel_name').get(function(req, res, next){
|
router.route('/:channel_name').get(function(req, res, next){
|
||||||
var protocol = req.protocol;
|
|
||||||
var subdomain = req.headers['x-forwarded-host'].split(".");
|
var subdomain = req.headers['x-forwarded-host'].split(".");
|
||||||
|
|
||||||
if((subdomain[0] != 'localhost' && !(subdomain.length >= 2 && subdomain[1] == 'localhost')) && protocol != "https") {
|
if((subdomain[0] != 'localhost' && !(subdomain.length >= 2 && subdomain[1] == 'localhost'))) {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,10 +107,9 @@ router.route('/api/mail').post(function(req, res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.route('/').get(function(req, res, next){
|
router.route('/').get(function(req, res, next){
|
||||||
var protocol = req.protocol;
|
|
||||||
var subdomain = req.headers['x-forwarded-host'].split(".");
|
var subdomain = req.headers['x-forwarded-host'].split(".");
|
||||||
|
|
||||||
if((subdomain[0] != 'localhost' && !(subdomain.length >= 2 && subdomain[1] == 'localhost')) && protocol != "https") {
|
if((subdomain[0] != 'localhost' && !(subdomain.length >= 2 && subdomain[1] == 'localhost'))) {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user