Search code examples
cvarnish

Varnish Sort Querystring Parameter


I've got a lot of requests that avoid caching because all of their list permutations are listed, ie:

http://.....&var=a,b,c
http://.....&var=a,c,b
http://.....&var=b,a,c
http://.....&var=b,c,a
http://.....&var=c,a,b
http://.....&var=c,b,a

Is there a clever way to hash these to the same value? Is the easiest way to sub in the sorted version of the querystring value?


Solution

  • I've written a module for Varnish which reorders the query parameters alphabetically.

    Blog post with some explanation:
    http://cyberroadie.wordpress.com/2012/01/05/varnish-reordering-query-string/

    Code can be found here: https://github.com/cyberroadie/varnish-urlsort