I have recently experienced some strange caching issues with Google Chrome. I have a website serving several JS and CSS files with far future expiration dates. Sometimes, Chrome would fail to load one of the files (usually our biggest JS file, but sometimes another), and a page Reload / Force Reload / browser restart do not help. The only way to get rid of the problem is to completely clear the browser cache.
I used the Chrome developer tools and noticed that Chrome is requesting the file with the following headers:
If-Modified-Since:Thu, 14 Apr 开发者_高级运维2011 19:09:29 GMT
Range:bytes=41681-41681
to which the server responds with a "304 Not Modified" status. The developer tools then list the file size a 0 bytes.
The interesting thing is that 41681 is the actual length of the page (after compression), and Chrome is strangely trying to request the next byte after the end of the file.
I used the Chrome "about:net-internals" page to examine the cache and found that the file is indeed cached but is mysteriously flagged as "RESPONSE_INFO_TRUNCATED". Other than that, the cached content look perfectly fine (I compared it with a working copy of the cached file).
I have searched all over the web and the only reference I could find to such problem is on Meta: https://meta.stackexchange.com/questions/89224/does-anyone-have-problems-viewing-so-in-chrome-11
The issue reported there sounds a lot like the problem we are having but there are no conclusions other than that clearing the browser cache is a temporary solution. That post is almost two months old, and several versions of Chrome have been released since and the problem still exists.
The only relevant Chrome bug that I found is this one (reference the meta post): http://code.google.com/p/chromium/issues/detail?id=62712. However there was no activity on this bug since it has been reported.
I am very curious whether anyone else experienced similar issues, and whether anyone has any idea about what might be causing this.
Thanks, Sagi
精彩评论