-
Notifications
You must be signed in to change notification settings - Fork 31
Add support for cache busting via etag header #68
Comments
To be precise, pushing a validator (e.g. etag) in link-rel-preload header can have two effects, depending on the result of the validation. i. force refetch of a fresh response if validator specified in the etag is not equal to that of a fresh response in the client’s cache, it could act as an indicator to refetch the resource ii. 0-RTT validation of a stale response if validator specified in the etag is equal to that of a stale response in the client’s cache, it could have the same effect as a pushed 304; i.e. the client can treat the cached resource as fresh, thereby omitting the roundtrip for a conditional GET The second point (which I did not mention on my original email) means that, if we adopt the proposed attribute, websites would no longer need to set |
That's really great! I didn't read the preload WD but there here are a couple of comments anyway:
Considering that:
Then:
Keeping this concept only inside a HTTP header make sense performance-wise (and ease browser implementation), but current web-application mostly use the markup Worth noting that not only (dynamically generated) webpages uses (or needs) cache busting for their assets, but CSS frameworks themselves need it for their dependencies.
|
It's not clear to me what the actual win here is, over a versioned + long-lived filename:
In short, even if we were to pursue this.. I don't think it's practically deployable? |
@igrigorik Thank you for your response. If we view this as a way to invalidate a fresh cache, I agree with you that there would be obstacles in deploying the method unless we could somehow convince all the browser vendors to support it. OTOH, if we view this as a way to revalidate a stale cache in 0-RTT (see ii in #68 (comment)), then IMO it would still be useful even if not supported by all the web browsers. My understanding is that most web developers dislike using versioned + long-lived filenames. They grudgingly use them as an optimization to reduce time spent by revalidating the resources at the same time keeping the freedom to update them. It should also be noted that the approach is not used optimally, developers often mark all of their asset files using a single version number. The number gets incremented when some of the asset files are changed, forcing the reload of all the asset files. If the popular web browsers could support the proposed extension, it might become an attractive choice for web applications developers. They can stop using versioned + long-lived filenames to have asset files freshly cached on the client side. Instead they can have the resource files stale-cached. The files would be validated 0-RTT on the browsers that support the extension, or would spend 1 RTT on the browsers that do not (note: time spent for revalidating many asset files has greatly reduced in HTTP/2 thanks to the improved concurrency). PS. Considering the fact that this proposal can be implemented using SW, it might be a good way to implement one and see how it goes. |
Apologies about the delay!
Yes, I guess that's true.
I'm not sure about like or dislike. Rather, I think it's a practical strategy that gets you the benefit of long-caching and instant updates, which is why it's so popular.
True, but that's an orthogonal issue.
My hunch is that developers won't be willing to take the penalty on browsers that don't support it; the penalty is too expensive and we can't expect support for this to happen overnight. Also, emitting an etag is its own can of worms: the server has to precompute the hash; many resources are cross-origin and it's effectively impossible to know their hash, etc. |
If done as part of I think such a mechanism, if needed, should be defined apart from preload, should be limited to content the server is authoritative for and should have thorough review of its security characteristics. Closing as this has been open for a while without much activity, and seems out-of-scope. |
Where exactly exists the "denial of refresh" attack?
Otherwise, the client fetch said resource as it may have done otherwise without the presence of the etag attribute (max-age, expires, ...). By the way it'd not hurt to limit the scope for which an etag (same domain). NB: Is there a better place than preload for such a feature? |
+@kazuho
It would be useful to add an etag attribute to the
link
HTTP header and even to the HTML tag to reflect which is the most up-to-date version of an asset and to do cache busting.In an example, instead of having
it would be nice to have
This is a solution proposed by Kazuho Oku to the problem of cache busting, see his original comment at : https://lists.w3.org/Archives/Public/ietf-http-wg/2016AprJun/0419.html . For completeness, I'm pasting it here:
The problem of cache busting has been brought around multiple times in the discussion list, see for example the thread linked above, and this email (which happens to contain a few useful pointers):
https://lists.w3.org/Archives/Public/ietf-http-wg/2016AprJun/0416.html
The text was updated successfully, but these errors were encountered: