Cache static content

Hi all,

Every time we deploy a new version of our code, statics assets are not cached. We use webpack and we concatenate a hash to the assets’ name, so they shouldn’t be requested again if they haven’t changed.

We’ve added a custom header in the _header file: /static/* Cache-Control: public,max-age=31536000,immutable I can see these headers applied, but, I don’t know why, when we deploy a new version, all assets are requested again but they haven’t changed (neither the name). How should we fix it?


I’d recommend using service workers for this case rather than relying on browser to cache the content themselves.

But applying service workers is a big change… I guess the problem with the current solutions is Netlify uses different Etag for every new version and this forces to reload not modified static content again.

Netlify claims that it’s technology is setup in such a way that as long as the files are the exact same hash, the cache would persist. Read more here:

So, if you still feel your cache isn’t working, service workers are the only hope and in today’s date, implementing one is not much work.