0

We have created an endpoint on Azure Front Door to access .azurewebsites.net through private link, and in my app service's web config I have created below rewrite rule to set HTTP_HOST value same as HTTP_X-Forwarded-Host. After adding this rule my Front door URL stops working. However as soon I remove this rule, front door url starts working. Issue is with Private link only. As soon as I route from public network, rewrite rule works as expected. Can you please suggest?

<rule name="Set value of HTTP_HOST to value of HTTP_X-Forwarded-Host header">
                <match url="(.*)"></match>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_X-Forwarded-Host}" pattern="^$" negate="true" />
                </conditions>
                <serverVariables>
                    <set name="HTTP_HOST" value="{HTTP_X-Forwarded-Host}"></set>
                </serverVariables>
            </rule>
AlokBhatt
  • 515
  • 3
  • 17
  • Could you please let us know the reason for configuring this rewrite rule? and what is configured in the origin host header field of your Azure Front Door? Microsoft recommends preserving the original HTTP host name when you use a reverse proxy in front of a web application. Having a different host name at the reverse proxy than the one that's provided to the back-end application server can lead to cookies or redirect URLs that don't work properly. – Imran May 30 '23 at 11:28
  • In case of Azure Front Door, it is recommended to leave the origin host header blank in the origin definition to preserve the host name. check this [reference](https://learn.microsoft.com/en-us/azure/architecture/best-practices/host-name-preservation) and [this](https://learn.microsoft.com/en-us/azure/frontdoor/origin?pivots=front-door-standard-premium#origin-host-header) too – Imran May 30 '23 at 11:32

0 Answers0