Caching issues with Chrome


(Serge) #1

Matrix Version:

We have a caching issue with Chrome.See spreadsheet screenshot:


Any idea as to why squid sets an obsolete Expires header which makes Chrome sends a Cache-Control: max-age=0 header back on next request? Expires in the past should not be occurring on that page based on what we are getting with IE or at least have a consistent proxy behaviour here.


(Marcus Fong) #2

If you really want to get to the bottom of this then you should probably log a ticket with Squiz Support to have it investigated, because I think there has to be more to it than meets the eye.

Chrome does have a certain characteristic where visiting a URL by typing it into the address bar and pressing Enter causes it to send “Cache-Control: max-age=0” headers - see https://bugs.chromium.org/p/chromium/issues/detail?id=179360. This will bypass Squid’s cache (unless Squid is configured to ignore it).

However, what the response headers in your spreadsheet indicate is that Matrix itself is sending non-cacheable headers with its response - notice that “Cache-Control” in the response is set to “no-store, no-cache, must-revalidate, post-check=0, pre-check=0”. An Expires header in the past is entirely consistent with this behaviour, because Matrix is deliberately sending non-cacheable headers. (You can verify this by appending _nocache to any Matrix URL - you’ll see exactly the same Cache-Control and Expires response headers.)

The thing is, though, Matrix doesn’t decide whether to send cacheable response headers based on either the client’s Cache-Control header or the client’s browser. So something doesn’t add up here, and it’s likely to need a closer inspection and more testing to sort out exactly what’s going on.


(Serge) #3

Thanks for a high quality response. I’ve opened a ticket with them.


(Dan Graver) #4

Just adding a followup here for those playing at home. Client contacted Squiz support and our investigation showed the issue to be as Marcus had described - Chrome will send header ‘max-age=0’ if you press Enter on the URL. This was advised to not be an issue, as normal mouse click browsing in Chrome does not do this behaviour, so will have negligible effect on cache hit rates for public users.

Additionally the no-cache response in Chrome (compared to cache response in IE) was from a logged-in browser session in Chrome, where Matrix will sent no-cache content by default because you’re logged in. Logging out (or Incognito) returned cached response.

All sorted, and thanks to Marcus for good insight on this one!