Service worker failed to register with the following exception.
Failed to register ServiceWorker. The origin of the provider scriptURL('https://dev.xyz.cdn.com') does not match the current origin ('https://dev.xyz.com').
Currently all the assets are deployed in CDN. So domain is not matching with script source url. How to resolve this issue?
You can't host service workers on a CDN. From the specification :
A service worker executes in the registering service worker client's origin. One of the advanced concerns that major applications would encounter is whether they can be hosted from a CDN. By definition, these are servers in other places, often on other origins. Therefore, service workers cannot be hosted on CDNs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.