Skip to content
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

Support assets on a CDN #33

Closed
laantorchaweb opened this issue Sep 19, 2016 · 2 comments
Closed

Support assets on a CDN #33

laantorchaweb opened this issue Sep 19, 2016 · 2 comments

Comments

@laantorchaweb
Copy link

laantorchaweb commented Sep 19, 2016

Hey @jkleinsc, any ideas on how to work when the assets are on a CDN?

Right now it throws a security error, and that's expected. I tried setting includeRegistration to false so I can start the service worker from my domain.

But, even if the service worker is installed none of the resources on the CDN are being cached.

@jkleinsc
Copy link
Owner

You need to specify the origin of the assets, for example

cacheFirstURLS: [{
  route: '/(.*)'
  options: {
    origin: 'https://yourcdn.com/'
  }
}]

Would use the cache first strategy on all items sitting on https://yourcdn.com/

More details about this can be found in the readme here: https://github.com/jkleinsc/broccoli-serviceworker#routing-options

@laantorchaweb
Copy link
Author

laantorchaweb commented Sep 22, 2016

Thanks!, this does save the assets on the cache storage with the URLs pointing correctly to the CDN. But it doesn't fetch the assets from there on the request. My vendor and app javascript files are also on the CDN, but I don't see that could be a problem.

service-worker and sw-toolbox are local files not on the CDN. I'll keep looking into it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants