[Support Guide] Understanding & unregistering service workers

Last checked by Netlify Support Team on May 26, 2022

A service worker is a script that your browser runs in the background to accomplish a variety of tasks. Browsers cache service workers for 24 hours by default, and don’t update them when you reload your page. Therefore, you may have a service worker on your site which could prevent you from seeing the latest and greatest changes that you’ve made.

If you suspect a service worker is causing this issue, I recommend disabling/removing the service worker from your site and unregistering it to see your latest change. You can unregister by going to your browser dev tools, under 'Application > Service Workers', there will be an option to unregister your current service worker.

Alternatively, you can use the following snippet in a javascript file or in the dev tools console:

navigator.serviceWorker.getRegistrations().then(function(registrations) {
  for(let registration of registrations) {
} })

If you have a different issue with a service worker, or need more information, comment below!

1 Like
Netlify + Gatsby serves old/cached (pre-Gatsby) version of site
Old version of website shown, works in incognito
Cache problems - old versions stay for a long time
Each new deploy requires hard refresh on clients
Primary domain cache problem
Netlify Function triggered on form submission includes incorrect payload
Running a script that updates a file before build
Redirect from Netlify subdomain to custom primary domain not working
Issue clearing an old cache file after a domain change
Form entries not collected
I've enabled my site through netlify for https. But my js files are still loaded with 1.1 http protocol
Custom domain doesn't update but netlify.app version does
“Uncaught SyntaxError: Unexpected token <” on deploy using Netlify
Netlify Form | CRA | ServiceWorker
Should Netlify clear cache when I upload from Gatsby Cloud?
Permanently forward Netlify subdomain to custom TLD
DNS changes not always correct after 48 hours
About caching gatsby pages
Nuxt - Some pages doesn't redirect to the right page correctly after refresh
Form 404 - Static Form in Svelte / Sapper
Deployed Gatsby Site Doesn't Represent Development Mode Site
Netlify serve old cached version
React build times out although the required file exists (Error: ENOENT: no such file or directory, open '/opt/build/repo/src/index.js')
Tranform Images not working with Large Media with Sapper
301 redirect not working
Netlify serve old cached version
Clear Cache on every deploy
Form submission - correct POST reply, but no entry on the submissions page
Weird situation on multiple Sites. Index page not updating
Old version of website shown, what could cause this?
Site not displaying updated GitHub commits
Trying Forms on React deploy
Site not updating with Github build
Cache issue on Netlify?
DNS records pointing to old Netlify site, not changed when same domain added to new site
Netlify serve old cached version
Ionic deployment problem
Site is live, but sill blank screen (react app)
Added new site using old url, and Netlify display old website (continuous deployment)
Understanding Browser Cache + Netlify
Only getting 404 through proxy
Cache issue on Netlify?
Does netlify clear cache every deploy?
Browser cache not clearing for Safari on custom domain
Cached version of website not updating on new build/repo change
Site not updating
Forms doesn't work in some browsers (Gatsby)
Do DNS records update automatically when you add a domain you own to a Netlify site?
Website Not working Even though DNS seems to be correct
Image load then disapear

Browsers cache service workers for 24 hours by default

read up a bit on this and found this https://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours

" The one exception to standard HTTP caching rules, and this is where the 24 hours thing comes in, is that browsers will always go to the network if the age of the service-worker.js entry in the HTTP cache is greater than 24 hours. So, functionally, there’s no difference in using a max-age of 1 day or 1 week or 1 year—they’ll all be treated as if the max-age was 1 day."

1 Like