better logging

This commit is contained in:
AJ ONeal 2018-06-21 19:36:21 +00:00
parent 4db9a8d53d
commit d2fde5c38c
1 changed files with 4 additions and 4 deletions

View File

@ -428,23 +428,23 @@ app.get(urls.pairState, function (req, res) {
module.exports.webadmin = function (state, req, res) {
//if (!loaded) { loaded = true; app.use('/', state.defaults.webadmin); }
console.log('[DEBUG] extensions webadmin');
var host = (req.headers.host || '').toLowerCase().split(':')[0];
if (state.config.webminDomain === host) {
console.log("DEBUG going to static");
console.log("[static] " + req.headers.host + req.url);
staticApp(req, res);
return;
}
if ((state.config.apiDomain || ('api.' + state.config.webminDomain )) === host) {
console.log("DEBUG going to api");
console.log("[api] " + req.headers.host + req.url);
req._state = state;
app(req, res);
return;
}
if ('www.' + state.config.webminDomain === host) {
console.log("DEBUG going to www");
console.log("[nowww] " + req.headers.host + req.url);
nowww(req, res);
return;
}
console.warn("[unhandled] " + req.headers.host + req.url);
res.end("Didn't recognize '" + escapeHtml(host) + "'. Not sure what to do.");
};