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.
- boltsort.sort — Alias of
querystring.sort - querystring.add — Append a name and value to a URL query string
- querystring.clean — Remove empty parameters from a URL query string
- querystring.filter — Remove all parameters in the provided
querystring.filtersep-separated list from a URL query string - querystring.filter_except — Remove all parameters except those in the provided
querystring.filtersep-separated list from a URL query string - querystring.filtersep — List separator used for query string filtering
- querystring.get — Read a parameter from a URL query string
- querystring.globfilter — Remove matching parameters from a URL query string by glob
- querystring.globfilter_except — Remove non-matching parameters from a URL query string by glob
- querystring.regfilter — Remove matching parameters from a URL query string by regular expression
- querystring.regfilter_except — Remove non-matching parameters from a URL query string by regular expression
- querystring.remove — Remove the query string from a URL
- querystring.set — Set (or replace an existing) parameter in a URL query string
- querystring.sort — Sort URL query string parameters