Downsides to using querystrings to version static files?
Asked Answered
C

1

6

It seems that in order to force users to refresh cached static files (e.g., .css, .js) some sites (e.g., stackoverflow.com) append querystrings to the end of files. For example:

<link rel="stylesheet" type="text/css" href="http://sstatic.net/stackoverflow/all.css?v=9ea1a272f146">

I think this is a good idea, and am inclined to start doing this as well. However, I have heard that there are downsides, such as proxies not properly caching files if a querystring is present.

What are the downsides to this type of versioning?

Catkin answered 30/9, 2010 at 22:20 Comment(0)
C
4

Only one downside that I know of: proxy caching (as you said):

http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

http://paulirish.com/2010/announcing-html5-boilerplate/#comment-34976

(I found out about these from the comments in http://www.html5boilerplate.com)

The percentage of users affected by this should be very low, though. I've used this technique for quite a while, and still do.

Cicatrix answered 30/9, 2010 at 22:33 Comment(2)
I agree. This is the solution I've used for awhile and it works pretty well. If you're able to easily, programmaticly just change the file name and all references to it, great, but other wise I think the query params solution is one of the best options.Lilybelle
Your links were extremely helpful, thank you. I've analyzed my IIS logs and I only seem to get a handful of requests from proxies, so the downside seems negligible in my case.Catkin

© 2022 - 2024 — McMap. All rights reserved.