To bust the image cache using version string, I used following:
<system.webServer>
<rewrite>
<rules>
<rule name="PNG Versioning">
<match url="(.*).png" />
<action type="Rewrite" url="{R:0}" appendQueryString="true" />
<conditions>
<add input="{QUERY_STRING}" pattern="ver=20190327" negate="true"/>
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
But changing the value of version string still ends up in 304
.
If I manually add version string to the image url, on each each update of version string I get a 200
response code as expected.
So, why isn't url-rewrite working similar to other method?
I got the answer. Cache- busting is not possible this way because:
When browser requests a resource:
If resource is in cache, it again sends a GET request to fetch the file but with some additional headers
if-none-match: 7dee9bc1f8cf1:0
if-modified-since: Tue, 04 Nov 2014 07:34:16 GMT
These additional headers instruct the server to only return the file if above conditions fail.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.