diff --git a/lib/vhost-sni-server.js b/lib/vhost-sni-server.js index e88b7b0..6f9e66f 100644 --- a/lib/vhost-sni-server.js +++ b/lib/vhost-sni-server.js @@ -99,6 +99,33 @@ module.exports.create = function (securePort, certsPath, vhostsdir) { function localAppWrapped(req, res) { console.log('[debug]', domaininfo.hostname + '/' + domaininfo.pathname, req.url); localApp(req, res, function (err) { + if (err) { + console.error(err); + res.end( + "" + + "" + + '' + + "" + + "" + + "
"
+                    + ""
+                    + "Method: " + req.method
+                    + '\n'
+                    + "Hostname: " + domaininfo.hostname
+                    + '\n'
+                    + "App: " + (domaininfo.pathname ? (domaininfo.pathname + '/') : '')
+                    + '\n'
+                    + "Route: " + req.url//.replace(/^\//, '')
+                    + '\n'
+                      // TODO better sanatization
+                    + 'Error: '  + (err.message || err.toString()).replace(/"
+                    + "
" + + "" + + "" + ); + return; + } if (!serveFavicon) { serveFavicon = require('serve-favicon')(path.join(__dirname, '..', 'public', 'favicon.ico')); }