solidusjs / solidus

A simple server that generates pages from JSON and Templates
MIT License
28 stars 7 forks source link

ETags are insufficient for asset bundles #60

Open pushred opened 11 years ago

pushred commented 11 years ago

I'm seeing some cache clearing issues for assets. Usually all seems to be okay, but I'm seeing some different experiences for other users. Firefox especially seems to have issues. @krackydile has the following cache entry that should have been expired by now if following the headers, but for some reason the browser is stubbornly refusing to clear that cache, even when directed to.

key: http://www.keithurban.net/compiled/scripts.js
fetch count: 3
last fetched: 2013-08-28 12:21:37
last modified: 2013-08-28 12:21:29
expires: 2013-08-28 13:21:29
Data size: 82637
file on disk: none
Security: This document does not have any security info associated with it.
Client: HTTP
necko:classified: 1
request-method: GET
request-Accept-Encoding: gzip, deflate
response-head: HTTP/1.1 200 OK Content-Encoding: gzip Accept-Ranges: bytes Cache-Control: public, max-age=3600 Content-Type: application/javascript Date: Wed, 28 Aug 2013 19:21:29 GMT Etag: "276944-1377686812000" Last-Modified: Wed, 28 Aug 2013 10:46:52 GMT Server: ECS (sjc/4F90) Vary: Accept-Encoding X-Cache: HIT x-powered-by: Express Content-Length: 82637

Despite the ETag matching the latest, the actual file contents are different.

I searched bugzilla for reports related to ETags but didn't see anything relevant or recent for this issue. I did find this thread which may provide some clues though. I'm wondering if Firefox disregards ETags on some level (if not outright) though as part of it's privacy efforts.

Fauntleroy commented 11 years ago

I thought our use of Last-Modified and Expires obviated the need for ETag. Is this in development? If so, shouldn't we just implement https://github.com/SparkartGroupInc/solidus/issues/63

pushred commented 11 years ago

They should, but this was an issue specific to Firefox, in production.

Fauntleroy commented 10 years ago

Going to come in and note that this, or something closely related, is causing big issues for asset cache clearing on Edgecast. We keep running into a problem where the markup cache is cleared, but the asset cache isn't, so at some point in the future this could cause serious issues.

Fauntleroy commented 10 years ago

Is this still a problem? Or has our heavy use of Edgecast hidden the problem...

pushred commented 10 years ago

Well in this particular case I think it may have been occurring in local development. Have you continued experienced any issues with cached assets in Firefox @krackydile?

It's possible this could be behind some of the occasional cache purging issues we've seen with Edgecast. grunt-filerev and grunt-filerev-replace should definitively address any CDN issues though.