I'm using query strings to burst out of cache, e.g.: mysite.css?201708311009 where the date is that of the last modification date of the file.

Running a speed test on PingDom gets me this result:

Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:

I'm unsure what to make of it.

On the one hand, it might defeat the whole purpose of caching, if it's true. However:

  • They don't back up their claims with facts or sources.
  • Apparently, Google PageSpeed Insight used to give the same advice but they stopped.
  • Major CDNs (ex: maxcdn) recommend the use of query strings to manage asset versions and those who give a word of caution (ex: keycdn) don't back up the claim.
  • WordPress relies on query strings for cache busting and powers 25% of websites. (It doesn't necessarily mean it's a best practice, but it's something.)

My question is two-fold:

  1. What are some known cases of query strings causing caching issues with proxy caching servers? (If none can be found, then the whole thing is just a rumor.)
  2. If it is an issue, are there alternative, besides changing the filename*? e.g.: are URL fragments acceptable (mysite.css#201708311009)?

*I'd rather avoid changing filenames for this if I can afford it because it's more of a burden to handle.

  • I've always used rewrite rules to make it mysite-201708311009.css for this reason. I started doing so years ago, and I don't know if it is still necessary to do so for caching. Commented Aug 31, 2017 at 11:48
  • See also my answer to this related question regarding "Squid": webmasters.stackexchange.com/a/86277/1243
    – MrWhite
    Commented Aug 31, 2017 at 15:06
  • "it might defeat the whole purpose of caching" - why do you think that? There's really no difference, except the query string method is just a bit easier to implement since it doesn't require URL-rewriting the request.
    – MrWhite
    Commented Aug 31, 2017 at 15:09
  • I really just meant that if it doesn't work for some (proxy) servers then indeed caching would be lost. Thanks for the link. Commented Aug 31, 2017 at 18:05

1 Answer 1


From http://bizcoder.com/caching-resources-with-query-strings:

Steve demonstrates when using a version number in the query string, the Squid proxy cache does not cache the static file at all. He goes on to say that Squid can be configured to cache these files, but it is not the default behaviour. Based on this information, he rightly suggested that people don’t use versions in their query string if they want to cache static resources.

That was in August 2008. Earlier that year, in May 2008, Squid released version 2.7 which changed their default behaviour to no longer refuse to cache URLs that contained a query string.

So the (not exhaustive) answer is: really old versions of what I believe is the most popular proxy software.

Personally I use the same solution Stephen Ostermiller mentioned in the comments - use rewrite rules to include a hash in the filename, although that isn't always possible. I wouldn't be too concerned if you're using query strings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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