I know there are a few posts on this around on cache busting but I was wondering if I could get a bit of help with summarizing options for cache busting, see if I've missed any. It is a significant issue with the enterprise webapp I maintain and customize as a Web Dev / Sys Admin.
From what I have seen, the most reliable is to create different versions of the file for each change, based on a time stamp or similar. File versioning has been used in the past by other admins prior to my time, at a basic level (something1.js, something2.js). Problem is we don't have a good method in place for this and the application itself has a lot of dependencies between pages from years of customization.
Recently, I tried adding a simple script that adds a cache-control Meta tag in the header to try to force reload of the files if older than 1 week. Here is my very rudimentary attempt at it.
let headForCacheControl = document.querySelector("head");
let cacheControl = document.createElement('meta');
cacheControl.setAttribute('http-equiv','cache-control');
cacheControl.setAttribute('content','must-revalidate max-age=604800');
headForCacheControl.appendChild(cacheControl);
Any feedback on this approach, any other options beyond these two, or advice on implementing file versioning is very welcome.