Query string

Copyright (C) 2012-2016, Dridi Boukelmoune dridi.boukelmoune@gmail.com
All rights reserved.

Varnish multipurpose vmod for URL query string manipulation. Can be used to normalize for instance request URLs or Location response headers in various ways. It is recommended to at least clean incoming request URLs (removing empty parameters or query strings), all other functions do the cleaning.

In your VCL you could then use this vmod along the following lines::

import querystring;
sub vcl_hash {
# sort the URL before the request hashing
set req.url = querystring.sort(req.url);
}

You can use regfilter to specify a list of arguments that must not be removed (everything else will be) with a negative look-ahead expression::

set req.url = querystring.regfilter(req.url, "^(?!param1|param2)");

The sort algorithm is a mix of Jason Mooberry's Skwurly and my own QuerySort with regards for the Varnish workspace memory model of the worker threads.