5

Google Chrome browser is not using the disk (or in-memory) cache for html responses. Has chrome's behaviour changed? Javascript/css files seem ok, but not html.

The same html response does get locally cached in Firefox and Edge.

Example html/js responses below. Http status code for both responses is 304 and the response is not https. I hit enter in the browser bar on the existing url, so no refresh was used. Hitting back/forwards browser buttons yields the same results.

html response headers (chrome disk/memory cache is not used on Chrome, but is used on Edge/FF) - note this is a dynamic page, not a static html page, so the url has no .html extension:

Cache-Control:public, max-age=3600
Content-Type:text/html
Content-Encoding:gzip
Date:Wed, 08 Nov 2017 09:57:31 GMT
ETag:"627b1769f19f9ff568faf620ea25d144"
Vary:Accept-Encoding

.js file response headers (disk/in-memory cache is used in all browsers including Chrome):

Accept-Ranges:bytes
Cache-Control:public, max-age=3600
Content-Encoding:gzip
Content-Type:application/javascript
Date:Wed, 08 Nov 2017 09:41:39 GMT
ETag:"1d2bce813ee8a28"
Last-Modified:Mon, 24 Apr 2017 10:46:50 GMT
Transfer-Encoding:chunked
Vary:Accept-Encoding

Changes I've tried:
Adding a static last-modified to the html response.
Adding an Age:0 header for the html response.
Changing the content-type of the html response to application/javascript.
None of this made a difference.

I don't have 'disable cache' enabled in Chrome dev tools and I get the same results on different machines.

Questions:

Primarily - is there something wrong with my response headers? (and if so, why does it work in other browsers but not Chrome?)

Has Google Chrome's behaviour changed? (if so, can you provide a link to a blog/article?)

Is local caching working ok in Chrome on your own website for html responses? Obviously this considerably increases traffic/load/costs for busy websites if it does not.

jimasp
  • 962
  • 9
  • 26
  • I too was facing a similar issue. There is a discussion going on about this here which might help you. https://stackoverflow.com/questions/11245767/is-chrome-ignoring-control-cache-max-age – noi.m Feb 03 '18 at 03:51

0 Answers0