Did your check traffic between browser and your IIS lately?How well Internet Explorer can deal with static resource caching?
Background:
Static resource caching is based on ETag If-None-Match pare. IIS send to client HTTP header ETag which is basically file hash. Resource stored in IE cache, next time IE will add to request for this resource http header If-None-Match with value of ETag. If file was not modified (If-None-Match match ETag at server) client should receive 304 response (Not changed) with empty content.
Scenario:
- Client request static resource (gif for example) for the first time. IIS serve it to client with response code 200. Resource stored in IE cache.
- Client make additional request for the same resource. IIS responds with code 304. Client use resource from IE cache.
- In some point in time, IIS service restarts.
- All subsequent requests from client for the same resource will end up with code 200 and file being downloaded on the wire. Why? What is happening?
- Situation will return to normal when client will clean IE cache.
Explanation:
Actually this situation is caused by combination of two problems.
- Default behavior of IIS6 is to alter ETags after each service reset. There is MD_ETAG_CHANGENUMBER property in IIS6 metabase, but it is not working in current version. There is hotfix for this problem http://support.microsoft.com/?scid=kb;en-us;823544&spid=2097&sid=49. It is not downloadable, but could be requested from MS support services. After hotfix installation you should add MD_ETAG_CHANGENUMBER property to metabase manually (for example using metabase explorer).
- IE will not update file ETag value in cache if file is unchanged. After IIS reset client continue to send an old value with If-None-Match header. It receive old file with new ETag and is not updating hash value because file remains unchanged. It is easily reproductive behavior, same for IE5.5 and 6. We not succeed to find solution to this problem.
Solution:
- Install IIS hotfix and add MD_ETAG_CHANGENUMBER property to metabase.
- If you control your clients, make them clear browser cache. Otherwise alter modified date of static files on web server. We used simple c# program for it, just a few line of code. From this point each client will download resource only once until file will be changed.