My goal is to \"whitelist\" certain querystring attributes and their values so varnish will not vary cache between the urls.
Example:
Url 1: http:/
A copy of runamok but i got + instead of %20 in my params so i have added that to my regex
sub vcl_recv {
# strip out certain querystring params that varnish should not vary cache by
call normalize_req_url;
# snip a bunch of other code
}
sub normalize_req_url {
# Strip out Google Analytics campaign variables.
# I allso stribe facebook local that are use for facebook javascript.
# They are only neededby the javascript running on the page
# utm_source, utm_medium, utm_campaign, gclid, ...
if(req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|fb_local|mr:[A-z]+)=") {
set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|fb_local|mr:[A-z]+)=[%.+-_A-z0-9]+&?", "");
}
set req.url = regsub(req.url, "(\?&?)$", "");
}