boltsort - QueryString params sort

Varnish 4.0 now has query sorting built in through the std VMOD.

At Vimeo we use Varnish to cache our player traffic. It has worked out great for us.
Varnish at this point has no built in module to sort querystrings. Say I have two of these:


Boltsort sorts the querystring and ensures that Varnish treats the above one and the same.
Insertion sort on tokenized querystring params makes it twice as fast as current qsort implementations.
Custom param compare instead of storing param lengths for each querystring param means lesser stack usage.


import boltsort;
sub vcl_hash {
# sort the querysting and use the sorted one for hashing
set req.url = boltsort.sort(req.url);

Used in production
Varnish version supported: 
Commercial support: 
Varnish Software


It's not working with varnish 4.0 there are compile error occuring while running configure as header file include/varnishapi.h from Varnish-source is missing. But that file is not there anymore.

checking for /usr/share/varnish/include/varnishapi.h... no
configure: error: "/usr/share/varnish" is not a Varnish source directory

I took the source for the vmod from the github repo ( and the current source download as well as the rpm's

It happens because the main branch of libvmod-boltsort is "3.0". The master source is compatible with Varnish 4. Just clone the repository and checkout the master branch that it will work well.

Bruno dos Santos