Ignore utm_* values with varnish?
Dridi Boukelmoune
dridi at varni.sh
Thu Oct 12 12:21:18 UTC 2017
On Thu, Oct 12, 2017 at 2:10 PM, Mattias Geniar <mattias at nucleus.be> wrote:
>> Can I 'ignore' query string variables before pulling matching objects from the cache, but not actually remove them from the URL to the end-user?
>
> The quickest ‘hack’ is to strip those parameters from the req.url, for a copy/paste’able example, please see here: https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl#L111-L115
You can indeed do it in pure VCL, but for long URLs it also means a
lot more workspace consumption. If you want to increase you
performance even further, vmod-querystring can sort too (if
appropriate). The difference with std.querysort is that a
vmod-querystring filter will both sanitize your URL and do the sorting
with the same memory footprint: no extra cost (except CPU time
obviously) comes from the sort operation.
Another interesting feature is the ability to whitelist query-params
instead, this way you may only retain what your application needs and
not care when the next campaign doesn't use Google Analytics' utm_*
parameters, they will be filtered out already.
Cheers
More information about the varnish-misc
mailing list