Re: [w3c/ServiceWorker] Soft Update seems way to aggressive (#1250)

> With updateViaCache: 'all' developers were having difficulty getting their service workers to update, since they were stuck in the cache. This is due to servers that set caching headers on JS by default.

I just wanted to elaborate on this: it's been a source of pain for a while now, and still remains a sore point for Chrome's users, which has [yet to update](https://bugs.chromium.org/p/chromium/issues/detail?id=675540) its behavior to bypass HTTP caching by default.

Many popular shared hosting environments will enable HTTP caching for static `.js` resources by default. The need to explicitly opt service worker JS files (at least ones that contains a versioned list of precached assets) out of caching has proven to be non-obvious. And while developers accustomed to native app store policies might be fine with delayed updates, it runs counter to web developer expectations.

Here are a few examples of this pain/confusion "in the wild":

- https://github.com/facebookincubator/create-react-app/issues/2440 (CC: @gaearon, who might have some thoughts about how this has affected the `create-react-app` community.)
- https://github.com/GoogleChromeLabs/sw-precache/issues/332
- https://github.com/googlearchive/workbox-microsite/pull/89 (it's something that *I've* gotten wrong in the recent past, and I should know better)
- https://github.com/NekR/offline-plugin/issues/63

When the Angular team added a [service worker generation to their CLI](https://www.npmjs.com/package/@angular/service-worker), they opted-out of the standard service worker update lifecycle entirely, in part to avoid these pain points. (Instead, they explicitly cache-bust the `fetch()` for a site's precache manifest, and effectively simulate the `install` and `activate` events.)

Opting-in, rather than opting-out, to HTTP caching of the service worker JS file was a positive change in the specification, and it would be unfortunate if browsers did not converge on that standard behavior.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1250#issuecomment-357043821

Received on Thursday, 11 January 2018 19:59:56 UTC