6 ms·
How does this work along with browser caches ?
by luvz2code 10y ago
How does this work along with browser caches ?
- bpicolo 10y agoCache-control headers. Browsers won't cache indefinitely unless you ask them to.
- Kiro 10y agoAm I insane or are cache-control headers unreliable? I always set cache-control: no-cache on my S3 files but still get complaints about people getting old versions with broken pages as result.
- chipperyman573 10y agoSome CDNs don't always listen to those (I've noticed cloudflare especially has a problem with them if I don't add the files to the ignore list in their control panel), maybe that's it?
- jgalt212 10y agoI don't rely on them. We set query parameters on new JS code to definitively bust caches. src="foo.js?v=1", then src="foo.js?v=2", etc. I'm sure people consider this a hack, so I'm open to hearing other suggestions.
- dcherman 10y agoIt's not a hack at all for resources you control - in fact, it's encouraged to do so in order to use very long lived Expires headers while still being able to deploy new versions of your app. It doesn't work for unversioned library code though where you want to automatically upgrade all users of your code as is the case with Twitter it looks like.
- tarancato 10y agoProblem with these is that many caching proxies consider all resources with a query string to be dynamically generated and won't cache them at all, which in the case of js/css/etc is bad
- dcherman 10y agoSure, but that's easily solvable by versioning assets in the filename itself. That's how the `filerev` task works for both Grunt and Gulp.
- effie 10y agoI use this as well, works like a charm.
- gcb0 10y agoyou are either insane, using them wrong, or following some bloggers guide instead of reading actual specs.
- ricardobeat 10y agoHad the same thought. Looking at the headers they serve the file with a mere 30m expire time.
- ptolts 10y agoI was wondering if the experimental group gets a cache time of 0 so they can immediately be rolled back.
- gcb0 10y agothey probably set no-cache, which gives them the worst performance. and don't even use it for their benefit since they decide what to serve based on dns, which is always cached in the os and the browser. found that write up extremely comical.