I was reading articles and forum posts about using version numbers in CSS/JS 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?


1 Answer 1


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 (aka "Cache Busting")...

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.