-
-
Notifications
You must be signed in to change notification settings - Fork 27k
index.html should be cache busted #6001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also need to update the service-worker and asset-manifest.json with the cache busted url |
This is a simple bat file that 'fixes' the issue echo "Building release artifact" set /a num=%random% call powershell -Command "(gc build/service-worker.js) -replace 'index.html', 'index.html?s=%num%%num2%' | Out-File build/service-worker.js |
/cc @jeffposnick does this make sense so users don't get bit by it as often? I'm not sure of the pitfalls here. |
Workbox already has steps in place to bypass the browser's cache when fetching a specific That code uses So... taking a step back, I'd say that it's not likely that what you're seeing is due to the need to cache-bust the URLs in the precache manifest. Maybe you just saw the older content after updating your site because there was an existing tab already open controlled by the older service worker? By default, the updated cache entries won't be used all existing tabs open to URLs controlled by the previous service worker are closed. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Is this a bug report?
Yes
Did you try recovering your dependencies?
N/A
Which terms did you search for in User Guide?
Service worker caching. Have spent quite a bit of time looking into this. Relates to #3665
Environment
N/A
Steps to Reproduce
Expected Behavior
New version is loaded
Actual Behavior
You will not get the new version for 30 days unless the user clears their browser storage
Reproducible Demo
N/A
Proposed fix:
Cache bust index.html in the precache manifest by adding a get parameter with the revision aka
{
"revision": "74b471cc3f1d86bbc95a5bcf5376e65e",
"url": "/index.html?r=74b471cc3f1d86bbc95a5bcf5376e65e"
}
Note: all other files are cache busted. Also chrome and firefox both no longer allow service-worker.js itself to be cached
The text was updated successfully, but these errors were encountered: