-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service Worker loaded from CDN #591
Comments
Any idea on how to get around this? |
Hmm - this is an odd one. It might be worth us adding an option to define navigator.serviceWorker.register((SW_PATH || __webpack_public_path__) + 'sw.js'); |
can we re-open this ticket? I am encountering the same issue. the suggestion from @developit might work |
can you please try this with the latest rc? |
@prateekbh , just tested it with latest rc. still being compiled as |
is this deployed somewhere? |
a ok this makes sense. I can take a look at it |
@prateekbh , i can create a PR, if it's ok. not sure if there is a standard guide that i need to follow though |
- introduced new cli args to define swPath, default would be '/'. - decoupled from using webpack public path, better to be implicit
… cdn issue - introduced new cli args to define swPath, default would be '/' - decoupled from using webpack public path, better to be implicit
@prateekbh , does the current |
Your cdn should be in the same tld, ideally your first party origin (if you don't use SSR which makes it harder) |
… of __webpack_public_path__ if it begins with http protocol, set it blank
Do you want to request a feature or report a bug?
Report a Bug
What is the current behaviour?
sw.js
is loaded from a CDN if a CDN is set in the webpackpublicPath
. This is forbidden:Failed to register a ServiceWorker: The origin of the provided scriptURL ('https://yourcdn.net') does not match the current origin ('https://yourapp.com').
If the current behaviour is a bug, please provide the steps to reproduce.
Add the following snippet to
preact.config.js
:It seems this was introduced in #323
What is the expected behaviour?
sw.js
must be loaded from the base domain. See w3c/ServiceWorker#940Please mention other relevant information.
The text was updated successfully, but these errors were encountered: