diff --git a/lib/webapp.js b/lib/webapp.js index 7314d4b6..b9a2fd8e 100644 --- a/lib/webapp.js +++ b/lib/webapp.js @@ -1560,9 +1560,11 @@ WebApp.prototype = { if ((req.get('x-forwarded-port') != gatewayPort) && (req.get('x-forwarded-host') != `${gatewayHost}:${gatewayPort}`) && ( req.query['zwed-no-redirect'] != 1 )) { + console.log(`default: redirecting user to ${this.options.gatewayRedirect+'/'} due to headers port=${req.get('x-forwarded-port')} and host=${req.get('x-forwarded-host')} without query`); res.redirect(this.options.gatewayRedirect+'/'); } else if (this.options.componentConfig.node.rootRedirectURL) { //will go to either gateway full url or own full url depending upon zwed-no-redirect. + console.log(`miss: redirecting user to .${this.options.componentConfig.node.rootRedirectURL} due to header port=${req.get('x-forwarded-port')} and host=${req.get('x-forwarded-host')} or query`); res.redirect( url.format({ pathname:'.'+this.options.componentConfig.node.rootRedirectURL, @@ -1570,6 +1572,7 @@ WebApp.prototype = { }) ); } else { + console.log(`else case, next`); next(); } }); @@ -1579,14 +1582,17 @@ WebApp.prototype = { if ((req.get('x-forwarded-port') != gatewayPort) && (req.get('x-forwarded-host') != `${gatewayHost}:${gatewayPort}`) && ( req.query['zwed-no-redirect'] != 1 )) { + console.log(`default2: redirecting user to ${this.options.gatewayRedirect+this.options.componentConfig.node.rootRedirectURL} due to headers port=${req.get('x-forwarded-port')} and host=${req.get('x-forwarded-host')} without query`); res.redirect(this.options.gatewayRedirect+this.options.componentConfig.node.rootRedirectURL); } else { + console.log(`else case2, next`); next(); } }); } } else if (this.options.componentConfig.node.rootRedirectURL) { this.expressApp.get('/', (req,res) => { + console.log(`no apiml, basic redirect to .${this.options.componentConfig.node.rootRedirectURL}`); res.redirect('.'+this.options.componentConfig.node.rootRedirectURL); }); this.expressApp.use('.'+this.options.componentConfig.node.rootRedirectURL, express.static(webdir));