0

I have an existing site which does not already have a dependency stack on Node.js and am looking to try to prevent browser errors due to cached javascript/css files after updates. Currently, all imports of local javascript/css have additional arguments in an attempt to curb this (as described here) like:

<script src="js/common.js?dev=4829">

But after updates it's clear this isn't working. Users still have to CTRL+Shift+R to hard-refresh to see the new content.

Server is running Apache under Linux, if that helps. Is there a better way to handle this which doesn't add the Node.js dependency stack?

Jorvis
  • 3,159
  • 1
  • 17
  • 16
  • There are couple of similar question. You can take a look at https://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers – brk Feb 26 '19 at 03:33

1 Answers1

0

I think you need to config Apache to not cache index.html. EX:

<Directory "PATH_TO_DIRECTORY_OF_INDEX.HTML">
<Files "index.html">
    FileETag None
    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"
</Files>

Let's try it. If it doesn't work, you can try few other ways here

Vu Luu
  • 792
  • 5
  • 16