Open molant opened 6 years ago
@molant The cache-control
header is set to no-cache
in the sonarwhal-worker
. What's the "right" cache-control header value that it should be changed to? It doesn't seem right to me to set a max-age
for the service worker since the content is mutable.
I think that if you move the scripts to /static/scripts
the gulp task should take care of updating the file names and the html that points to it.
Here's a couple of pointers, I hope they'll be of help if/when you decide to reintroduce service workers again:
For webhint-worker.js
:
Cache-Control
header is still desired (since the Chrome 68 changes, see link provided below) you will need to opt-in by setting updateViaCache
to the preferred value. If that is the case, no-cache
should suffice in making sure content is fresh, but yes the SW will incur a network request every navigation.
→ https://developers.google.com/web/updates/2018/06/fresher-swFor sw-reg.js
:
/webhint-worker.js
.
Because the service worker is in the root right now we are not cache busting it nor adding the right
cache-control
header. We should find a way to do this.