Closed 1000TurquoisePogs closed 6 months ago
i found the gateway has headers,
x-forwarded-host: zowe_host:port x-forwarded-prefix: /zlux/ui/v1 x-forwarded-port: 7554
this seems to be the info necessary to determine whether or not to redirect.
This was implemented in 2.10.0
In v2, issues like #863 appear when you access the desktop directly rather than through the gateway. When the gateway is up, you want to use it because it helps with HA, load balancing, port management, security, etc etc. People shouldn't be accessing the desktop directly if they can help it.
So, if a request comes into the desktop that doesnt originate from the gateway, we should redirect to it! The code should probably go right here https://github.com/zowe/zlux-server-framework/blob/v2.x/staging/lib/webapp.js#L1570-L1581 where we already do
res.redirect
but not to the gateway.The main challenge is we CANT redirect if the request came from the gateway. This would cause an infinite loop of redirects. So, we need a way... something from the
req
object to know the request is/isnt from the gateway, and CONDITIONALLY redirect based upon that.