The router should check for the existence of X-Forwarded-Host and X-Forwarded-Scheme and construct route.url using the public host and protocol (https://website.com/page).
Consider adding a new route property to store the app server URL (including the port), such as route.proxiedURL so server logs can reference the correct value (public app server logs would contain the original web address, while app servers behind proxies would reflect the app server URL in their logs).
Behind a proxy, the router uses the host (
request.headers.host
) when constructingroute.url
, but not the host protocol:Web address: https://website.com/page App server: http://127.0.0.1:8080/page
route.url
: http://website.com/pageThe router should check for the existence of X-Forwarded-Host and X-Forwarded-Scheme and construct
route.url
using the public host and protocol (https://website.com/page).Consider adding a new route property to store the app server URL (including the port), such as
route.proxiedURL
so server logs can reference the correct value (public app server logs would contain the original web address, while app servers behind proxies would reflect the app server URL in their logs).