Search code examples
cssbrowser-cacheupdating

Is query string approach reliable?


I am looking for some effective ways to bypass the cache whenever necessary. In the process of searching for that I have found this link

From the referenced post I found that the query string approach may not work when the squid like proxies are used. I did not test this.

I see that stackoverflow in itself is using the query string approach, below is the screenshot for the same captured before login to the site.

enter image description here

Would like to know if the query string approach is a reliable solution to push the css and js updates whenever a new software build is released.


Solution

  • It's reliable browser side, meaning that since the URL is different (because there's a different query parameter), it will fetch a new copy.

    Server side it depends on your server. Some caching proxies may ignore query parameters for the purpose of determining URL equality. AWS CloudFront for example does so by default. That's always a configurable setting. Since, presumably, you are in charge of the server, you can configure it as needed.