How to configure Azure App Service so that the cache-busting rewrite rules in our Web Forms app's web.config work?

Jan J. Vopalensky 0 Reputation points
2023-02-01T18:46:02.03+00:00

In our ASP.NET 4.8 Web Forms app web.config file we have following rewrite rule under the

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,239 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jan J. Vopalensky 0 Reputation points
    2023-02-09T15:54:49.91+00:00

    I found the issue was caused by this rewrite rule we had at the wwwroot level :

    <rule name="Ensure valid host header" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
         <add input="{HTTP_HOST}" matchType="Pattern" negate="true" pattern="^((.*)\.xxxxxxx\.com|beta\.yyyyyyy\.com)$" ignoreCase="true" />
        </conditions>
    </rule>
    

    where: 'xxxx' and 'yyyy' are strings used by our app's domain name.

    FYI - our app is running in a virtual app sub-folder, where the cache-busting rewrite rules are defined in its web.config file. Since our current Azure App Service testing does not use any of these strings in the domain name, the URL requests did not get through.