Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
How to clear angular service worker cache in all clients?

First of all checked all stackoverflow Q/A and haven't found my answer.

I have Angular 13 project which always used service worker (ngsw.json + ngsw-worker.js) in production build. Later the back-end api url was changed to different one in environment.ts files and after deploy to Amazon S3 cloudfront the Front-end is still calling the the old endpoint.

Okey, so it seems that my service worker cached all files and isn't updating. I have tried updating it via swUpdate, but it just don't help because it can't see any changes so I just deleted serviceWorker :

angular.json :

"serviceWorker": false,

index.html :

 <script>
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.getRegistrations().then(function (registrations) {
        //returns installed service workers
        if (registrations.length) {
          for(let registration of registrations) {
            registration.unregister();
            document.location.reload();
        }
     }
  });
}
  </script>

Ran : npm run prerender

Deployed dist/browser to Amazon S3 Cloudfront which don't have any service worker file and It should delete any used service worker in all client browsers + reload the page. Noone of this is happening.

If client is not opening dev tools , old service worker is still giving an old api url.

How to reset all cache and service worker in all my clients ?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda