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

144
Vistas
Service worker ignores the fetch cache setting

On a web page I have:

let response = await fetch(url, { cache: "no-store"});

Then in the service worker I have:

function handleFetch(event) {
    console.log(event.request.cache)  // Always prints 'reload', should be 'no-store'
}
self.addEventListener("fetch", handleFetch);

I require cache to be set to no-store not reload, i.e. the value it was set to. Chrome ignores the value and always changes it to reload. Am I doing something wrong or is this a case of Chrome inforcing its own value?

Further more to prove cache set correctly on the request I tried:

const init = { cache: "no-store"};
let request = new Request(url, init);
console.log(request.cache);  // Prints 'no-store'
let request = new Request(url, init);
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I think this is a Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1317680

I guess I will just use a custom header or Cache-Control header until its sorted out.

about 4 years ago · Juan Pablo Isaza Denunciar

0

From the MDN docs:

no-store — The browser fetches the resource from the remote server without first looking in the cache, and will not update the cache with the downloaded resource.
reload — The browser fetches the resource from the remote server without first looking in the cache, but then will update the cache with the downloaded resource.

https://developer.mozilla.org/en-US/docs/Web/API/Request/cache

So it seems that Chrome wishes to cache everything internally, because reasons, it might be some internal optimisation, and because of that supersedes your cache settings with their own, but respecting your wishes that you wish to have the "freshest data" by changing it to reload.

So you get the "newest uncached data", chrome gets to cache it for itself. Best of both worlds.

about 4 years ago · Juan Pablo Isaza Denunciar
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