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

Cache Invalidation #197

Closed
zackify opened this issue Mar 3, 2017 · 6 comments
Closed

Cache Invalidation #197

zackify opened this issue Mar 3, 2017 · 6 comments

Comments

@zackify
Copy link

zackify commented Mar 3, 2017

Sorry if this has been asked before, but I'm trying to figure out the best way to push new releases and have the service worker be updated.

Right now, I upload all of webpack's output to S3 and then serve it through cloudfront. All outputted files have a hash in front of them, except the sw is always the same filename.

Should I simply make it so that the serviceworker has a hashed filename as well, or make it so that it is never cached so that any page load grabs the latest version of it? I hope this makes sense.

@NekR
Copy link
Owner

NekR commented Mar 3, 2017

Hi, @zackify!

Short version:
Never cache SW file. Don't change its name, e.g. don't hash it.

Long version:
#127 -- You'll need to read whole thread to understand all the details.

:-)

@NekR
Copy link
Owner

NekR commented Mar 3, 2017

(I hope that's correct thread, I believe it is)

@zackify
Copy link
Author

zackify commented Mar 9, 2017

Yes, I have this working perfectly. On AWS I never cache it, and auto update every two minutes and reload my app. Btw this is super fast on the reload since it's after the new worker caches everything! Love this plugin :)

@zackify zackify closed this as completed Mar 9, 2017
@NekR
Copy link
Owner

NekR commented Mar 9, 2017

Love this plugin :)

😎

@ndbroadbent
Copy link

ndbroadbent commented May 17, 2017

@NekR Thanks for the explanations here and in #127. It makes sense why you don't want to add a hash to the service worker JS filename.

I'm still going to cache this file with Cloudflare, but I'm just going to purge the Cloudflare cache after uploading to S3. I already do this with my index.html and other HTML files.

@NekR
Copy link
Owner

NekR commented May 19, 2017

@ndbroadbent that's probably okay, I'm not sure actually. Let us know if works or not for you 👍

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

3 participants