Re:How Twitter deploys its widgets JavaScript
by bpicolo on Saturday October 01, 2016 @03:57PM
(#12619623)
Cache-control headers. Browsers won't cache indefinitely unless you ask them to.
[ Parent
| on HN ]
Re:How Twitter deploys its widgets JavaScript
by Kiro on Saturday October 01, 2016 @06:25PM
(#12620154)
Am 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.
Re:How Twitter deploys its widgets JavaScript
by chipperyman573 on Saturday October 01, 2016 @06:29PM
(#12620169)
Some 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?
Re:How Twitter deploys its widgets JavaScript
by jgalt212 on Saturday October 01, 2016 @06:31PM
(#12620183)
I 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.
Re:How Twitter deploys its widgets JavaScript
by dcherman on Saturday October 01, 2016 @09:32PM
(#12620686)
It'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.
Re:How Twitter deploys its widgets JavaScript
by tarancato on Sunday October 02, 2016 @06:00AM
(#12621679)
Problem 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
Re:How Twitter deploys its widgets JavaScript
by dcherman on Sunday October 02, 2016 @01:39PM
(#12623391)
Sure, but that's easily solvable by versioning assets in the filename itself. That's how the `filerev` task works for both Grunt and Gulp.