KamoCRM

A stale service worker on a redirected apex is replaced with one that removes itself

Fixkamo-nowww
Shipped
September 28, 2026 at 8:57 PM UTC
Author
Kamo
Commit
d9c533f

https://kamouniverse.com/ "does not go anywhere" in the owner's browser, while it 308s to www for everyone else. The access log showed why: that browser sent nothing but GET /sw.js. An app that once lived on the apex had installed a service worker there. The worker answers every visit to the origin from its own cache, so the request never reached this service and the redirect never happened. Its update check for /sw.js got the 308, and a worker script behind a redirect is refused, so it could never be replaced. /sw.js and /service-worker.js now answer 200 with a worker that takes over at once, deletes every cache, unregisters itself and reloads its pages. Those pages then reach this service and are redirected like any other visit. This applies to every host that reaches this service, because none of them has an app any more (a host with an app is routed to that app), and it is checked before any redirect. Verified against a local production build: /sw.js and /service-worker.js return 200 JavaScript with no-store; / and any other path still 308 to www, path and query kept; /api/health returns 200.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing