Open lidel opened 4 months ago
Do we have an example website in this state? The only one I know of is https://helia-service-worker-gateway.on.fleek.co/ right now which you can test at https://helia--service--worker--gateway-on-fleek-co.ipfs.sw.sgtpooki.com
Problem
What happens when service worker gateway is used to load website which has own service worker code?
IIUC if the scope of the new service worker is the same as or a subset of the scope of the existing service worker, the new service worker will not be able to take control until the existing service worker is unregistered or its scope is changed.
AFAIK attempting to register a service worker with a conflicting scope won't result in an error, but it won't replace the existing service worker either, creating situation which is hell to debug and reason about.
Solution
navigator.serviceWorker
registration involves sending HTTP request for worker code with `Service-Worker: script" headerHTTP 501 Not Implemented
with human-readable error, or at least link to this issue.