asp.nethtmlweb-confightml5boilerplate

Why is the cache busting rule declared in web.config being ignored?


I'm trying to use the rewrite rule from the HTML 5 Boilerplate project to make circumventing browser cache (aka cache busting):

<rewrite>
    <rules>
        <rule name="Cachebusting">
            <match url="^(.+)\.\d+(\.(js|css|png|jpg|gif)$)" />
            <action type="Rewrite" url="{R:1}{R:2}" />
        </rule>
        <rule name="Remove WWW" stopProcessing="true">
            <match url="^(.*)$" />
            <conditions>
              <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
            </conditions>
            <action type="Redirect" url="http://chewsy.com{PATH_INFO}" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

If i try to access my css with /css/all.123456.css, it fails to find the file with the error reporting that it's looking for /css/all.123456.css (no rewrite). I've tried commenting out the "Remove WWW" rule to see if that was a conflict, but same behavior.

Any ideas why this rule isn't being applied and rewriting the URLs?

Update: I'm using these settings for my web server in VS2010: enter image description here


Solution

  • <match url="^(.+)\.\d+\.(js|css|png|jpg|gif)$" />
    <action type="Rewrite" url="{R:1}.{R:2}" />
    

    I pressume you want to get /css/all.css, if not, post the desired result...

    EDIT: VS internal development server (Cassini) doesn't support IIS URL Rewriting Module, you would have to use IIS (Express) for that, or some third party component (http://urlrewriter.net/)...