LOG IN SIGN UP
Documentation

Query string manipulation VCL features

Fastly provides a number of extensions to VCL, including several functions for query-string manipulation based on Dridi Boukelmoune's vmod-querystring for Varnish.

Functions

Examples

In your VCL, you could use querystring.regfilter_except as follows:

1
2
3
4
5
6
import querystring;

sub vcl_recv {
    # return this URL with only the parameters that match this regular expression
    set req.url = querystring.regfilter_except(req.url, "^(q|p)$");
}

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

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