Added possible crash-fix for subdomain-redirecting

This commit is contained in:
Kasper Rynning-Tønnesen
2018-05-30 14:22:13 +02:00
parent b971074788
commit e3c15431c5

View File

@@ -122,6 +122,7 @@ function onListen() {
function routingFunction(req, res, next) {
var client = require('./apps/client.js');
var admin = require('./apps/admin.js');
try {
var url = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'] : req.headers.host.split(":")[0];
var subdomain = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'].split(".") : req.headers.host.split(":")[0].split(".");
@@ -130,4 +131,7 @@ function routingFunction(req, res, next) {
} else {
client(req, res, next);
}
} catch(e) {
res.sendStatus(500);
}
}