: Tradeoffs around using a query string vs embedding version number in the CSS/JS files I was reading articles and forum posts about using version numbers in CSS/JS files. http://www.stevesouders.com/blog/2008/08/23/revving-fil
I was reading articles and forum posts about using version numbers in CSS/JS files.
www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ http://www.particletree.com/notebook/automatically-version-your-css-and-javascript-files/
It turns out that embedding version numbers in file names are more reliable than using a query string. The articles and discussions I found were back in 2008 or so. I was just wondering if this is still the case today or have things changed with browsers and servers handling things differently? Is the query string now equally reliable?
More posts by @Si4351233
1 Comments
Sorted by latest first Latest Oldest Best
Just to clarify, since it's not explicitly mentioned in the question, that the reason for doing this in the first place is to break the client cache...
As far as I know the only reason to use an "embedded version number" in the filename itself over using a "dynamic" query string was that some (outdated?) proxy servers did not cache URLs that varied only by query string - the query string was simply ignored. Browsers (and servers) have never had a problem with the query string method.
Like you say, those articles are from 2008. I believe the situation is "better" these days.
The first article you link to refers to the "Squid" proxy server failing to cache resources with a query string. Whilst this was true in it's default configuration "back then", it could be configured to cache query strings, according to this ServerFault.com question. And, according to the comment on that answer, this became the default configuration in "version 2.7 (2008)".
From the Squid Cache Wiki - Caching Dynamic Content:
The obsolete default configuration of squid prevents the caching of dynamic content (pages with ? in the URI) .... That policy setting was created at a time when dynamic pages rarely contained proper Cache-Controls, that has now changed. From the release of Squid 2.7 and 3.1 the squid developers are advocating a change to this caching policy.
The Stack Exchange sites are generally considered to follow best practise and these sites use the query string method.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.