disallow fallthru from one app to another
This commit is contained in:
parent
c704eda6b6
commit
669c69e5eb
|
@ -79,13 +79,14 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log('[log] [once] Preparing mount for', domaininfo.hostname + '/' + domaininfo.dirpathname);
|
||||
domainMergeMap[domaininfo.hostname].mountsMap['/' + domaininfo.dirpathname] = function (req, res, next) {
|
||||
if (appContext) {
|
||||
appContext(req, res, next);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[log] LOADING "' + domaininfo.hostname + '/' + domaininfo.pathname + '"');
|
||||
console.log('[log] LOADING "' + domaininfo.hostname + '/' + domaininfo.pathname + '"', req.url);
|
||||
getAppContext(domaininfo).then(function (localApp) {
|
||||
//if (localApp.arity >= 2) { /* connect uses .apply(null, arguments)*/ }
|
||||
if ('function' !== typeof localApp) {
|
||||
|
@ -94,10 +95,18 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
|
|||
|
||||
// Note: pathname should NEVER have a leading '/' on its own
|
||||
// we always add it explicitly
|
||||
function localAppWrapped(req, res) {
|
||||
console.log('[debug]', domaininfo.hostname + '/' + domaininfo.pathname, req.url);
|
||||
localApp(req, res, function (err) {
|
||||
res.end('{ "error": { "messages": "Route matched '
|
||||
+ domaininfo.hostname + '/' + domaininfo.pathname
|
||||
+ ', but was not handled. Forcing hard stop to prevent fallthru." } }');
|
||||
});
|
||||
}
|
||||
try {
|
||||
domainMergeMap[domaininfo.hostname].apps.use('/' + domaininfo.pathname, localApp);
|
||||
domainMergeMap[domaininfo.hostname].apps.use('/' + domaininfo.pathname, localAppWrapped);
|
||||
console.info('Loaded ' + domaininfo.hostname + ':' + securePort + '/' + domaininfo.pathname);
|
||||
appContext = localApp;
|
||||
appContext = localAppWrapped;
|
||||
appContext(req, res, next);
|
||||
} catch(e) {
|
||||
console.error('[ERROR] ' + domaininfo.hostname + ':' + securePort + '/' + domaininfo.pathname);
|
||||
|
@ -188,7 +197,7 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log('[log] [once] Loading mounts for ' + domainApp.hostname);
|
||||
console.log('[log] [once] Loading all mounts for ' + domainApp.hostname);
|
||||
domainApp._loaded = true;
|
||||
app.use(vhost(domainApp.hostname, domainApp.apps));
|
||||
app.use(vhost('www.' + domainApp.hostname, domainApp.apps));
|
||||
|
|
Loading…
Reference in New Issue