Comments (3)
You should never cache SW script, as well as you don't cache AppCache's
manifest. Best way to serve SW script is with Cache-Control: no-cache
header, so browser will now that it has to be revalidated each time page
loads.
Even more, you cannot cache SW for more than 24 hours. Maybe you can, of
course, but that cache is ignored by the browsers after 24 hours of last SW
script download.
This is security limitation to not let people do footguns, as you just
wanted to do. Hope it helps.
On May 28, 2016 2:12 AM, "Ole Bjørn Michelsen" [email protected]
wrote:
We are caching all assets with a far-future expire on our webserver.
Therefore we need to hash the service worker script in order to update to
new versions, but this does not seem to work:new OfflinePlugin({
ServiceWorker: {
output: 'sw-[hash].js'
}
})Just outputs it literal: sw-[hash].js
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#56, or mute the thread
https://github.com/notifications/unsubscribe/ABIlkZIZnw3AhSrRmiQ_4O89iIZ2T6SEks5qF3pLgaJpZM4Io7a9
.
from offline-plugin.
I was just hoping to avoid managing special cache headers for individual files, but makes sense to just not cache it. Didn't know about the max 24h limit.
Thanks for the info, good to know!
from offline-plugin.
@omichelsen you probably don't need to set any cache control headers for SW file, but browsers suggest to set it to no-cache
. But if you serve it already with cache headers (e.g. forever cache) then it's better to set on small setting for sw.js
to make sure it is's always updated properly, e.g. proxies and CDN may cache it, which will result in forever stale version, etc.
from offline-plugin.
Related Issues (20)
- Question - SW caching all assets site-wide HOT 1
- In Angular 9, files inside directories are not being cached
- Ideas for Documentation to Help with Troubleshooting
- Some files missing in cache on SW first load/install HOT 1
- Caching subpath urls
- Caching fails to download assets in Chrome 85 HOT 1
- Issue with default path
- [question] Having Multiple runtime installations
- Problem with Webpack 5.0 HOT 17
- Micro Front-ends structure with single-spa
- Auto update doesn't work
- After removing redux-offline, how do we ensure that client's who have old versions get the latest update?
- `onInstalling` doesn't seem to be called, because `ignoreInstalling` is always true
- offline-plugin does not serve assets from service worker
- Webpack 5 compatibility HOT 3
- The "path" argument must be of type string. Received undefined HOT 4
- Cache Images from AWS S3
- Pass ServiceWorker version to the install events
- Terser Plugin issue while building with webpack-cli HOT 3
- upgrade ejs package | CVE-2022-29078 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from offline-plugin.