chobo2
chobo2

Reputation: 85765

Cache Busting Not Working? Google Chrome?

Why does cache bursting not working for me without me hitting F5?

In my index.html that gets generated by webpack I have this javascript file(which contains my reactjs site)

Right now on production I have something like this

 <script type="text/javascript" src="/main.b2c9dad20992aaf2f272.js"></script></body>

I just built a new file and in index.html I have

  <script type="text/javascript" src="/main.087b578d2cde3ed8379f.js"></script></body>

Yet everyone I test it with keeps getting their cached version of the site. Most people I have access to are using chrome so I can't say if this is only a chrome thing or all browser thing.

Upvotes: 0

Views: 2742

Answers (1)

Stephen
Stephen

Reputation: 69

Chrome seems to be pretty enthusiastic about caching. I've pushed out a few updated js files that required multiple hard refreshes (Ctrl + F5) before Chrome decided to check for a new file.

Adding the following header to the server response caused a miraculous reduction in help desk tickets from users that needed to clear their cache.

Cache-Control: must-revalidate

Upvotes: 2

Related Questions