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

Laurence Ede 5 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.
1,080 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,906 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.