React app : old version kept in cache until I inspect it
I've actually found what the problem was: the index.html
was cached, and so it was pointing to old js files which were also cached.
The way I solved it was to add this config to an .htaccess
file at the root of the app (although configuring apache through other means might also work):
<FilesMatch "\.(html)$">
FileETag None
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch>
In the end, it was unrelated to the service worker. It only had to do with the way index.html
was cached.