I recently read on Meta about some browser not flushing their cache even after reading a script url of this form
myscript.js?v=1234
so to go around the problem i am thinking about implementing a solution i also read but without any details given to it. something like myscript-1234.js and reroute to the actual correct file, but i have a doubt now.
Should i rewrite that url to myscript.js or to myscript.js?v=1234 ? I am actually confused as to how it even going to make a difference to have a rewriting.
Your rewriting should not redirect to any other URL (which would the be fetched by the browser), but should be “internal” on your server.
What I mean is that when receiving a request for “
myscript-1234.js“, your server should instead serve the content of themyscript.jsfile ; which will always be the last version.In the end :
myscript-1234.js,myscript-1235.js,myscript-1236.js, …myscript.js-XYZportion of the file name before trying to read it from disk.