Giter VIP home page Giter VIP logo

Comments (4)

Alex-DG avatar Alex-DG commented on May 30, 2024 1

In case someone has the same issue I had here what I've done :

So far I was using Heroku, I struggled a bit to handle this cache-control I figured out you can add a no cache param to serve(check there). I was not really satisfied. So I look for others possibilities, I came across Firebase where you can actually very easily doing this headers configuration through a firebase.json file, it works like a charm now.

from preact-starter.

lukeed avatar lukeed commented on May 30, 2024

Hey Alex, thanks!

This is because your Heroku server is caching the service-worker.js file, which is the main gotcha for Service Workers.

screen shot 2017-09-18 at 8 25 25 am

You have to turn off caching for the SW file specifically, as this is the only way that the SW can discern if there's a newer version of itself.

If cached, the following /service-worker.js requests, will all return the same content with the same versioning info (and the same assets cache definition), which tells the registered SW that there is not anything new to worry about, so nothing changes.

Hope that helps!

from preact-starter.

Alex-DG avatar Alex-DG commented on May 30, 2024

Thank you very much for your help on it, @lukeed !

From my understanding I need to specify something like cache-control:private, max-age=0, no-cache in my sw header.

from preact-starter.

lukeed avatar lukeed commented on May 30, 2024

Yeah, I forget you can't specify headers with serve -- maybe I'll look into PR'ing that. Most static-servers will let you configure headers, like Firebase hosting.

Thanks for following up~!

from preact-starter.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.