more descriptive error message

This commit is contained in:
AJ ONeal 2017-08-03 15:56:19 -06:00
parent 2357319194
commit 983a6e2cd7
1 changed files with 8 additions and 3 deletions

View File

@ -443,16 +443,21 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
});
});
prom.then(function (handled) {
// XXX TODO SECURITY html escape
var host = (headers.host || '[no host header]').replace(/</, '&lt;');
// TODO specify filepath of config file or database connection, etc
var msg = "Bad Gateway: Goldilocks accepted '" + host + "' but no module (neither static nor proxy) was designated to handle it. Check your config file.";
if (!handled) {
conn.end([
'HTTP/1.1 404 Not Found'
'HTTP/1.1 502 Bad Gateway'
, 'Date: ' + (new Date()).toUTCString()
, 'Content-Type: text/html'
, 'Content-Length: 9'
, 'Content-Length: ' + msg.length
, 'Connection: close'
, ''
, 'Not Found'
, msg
].join('\r\n'));
}
});