Why does my service worker still return an old response when it has Cache-Control: no-store?

Was this question useful?Community ranking

Answers

1 answer

Because `Cache-Control: no-store` controls HTTP caches, not the service worker's separate Cache Storage. A fetch handler (or a Workbox CacheFirst/StaleWhileRevalidate route) can keep returning a response it stored earlier, and a newer `no-store` response won't automatically remove that old entry. Check DevTools > Application > Cache Storage plus the fetch handler or Workbox route. Delete or version the old cache, then use a network-first strategy or explicitly skip `cache.put` for responses whose Cache-Control includes `no-store`. If something must always be fresh, `fetch(url, { cache: 'no-store' })` also avoids reuse by the browser HTTP cache, but it doesn't override a service worker that chooses to answer from Cache Storage.

Was this answer helpful?Community ranking

Your answer

Sign in to answer.

Keep exploring

Similar questions

Browse all