Why doesn't Application Gateway populate X-Forwarded-Host header?

Laurence Ede 0 Reputation points
2024-06-19T14:32:25.8333333+00:00

Previously I have followed this Microsoft guide on configuring applications to work behind reverse proxies by using the X-Forwarded-Host header, however Azure Application Gateway does not include this header and link generation, redirects, etc. are not working correctly as a result. It does however include a bunch of other X-Forwarded- headers but not this one for some reason.

It seems bizarre that the first guide cites conventional behaviour for reverse proxies (i.e. setting the X-Forwarded-Host header) which is then not followed by Microsoft's own reverse proxy implementation, and furthermore there is no mention in that guide as to how to use X-Original-Host which the documentation states is provided by Application Gateway and I presume is the intention?

I'll look into workarounds such as header rewrites, but I don't understand the disconnect here.

EDIT - Using a rewrite in application gateway is a workaround, as is I assume configuring the ForwardedHostHeaderName property similar to as shown here.

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
999 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,252 questions
{count} votes