Ignore utm_* values with varnish?

Dridi Boukelmoune dridi at varni.sh
Thu Oct 12 12:02:04 UTC 2017


On Thu, Oct 12, 2017 at 1:56 PM, Pinakee BIswas <pinakee at waltzz.com> wrote:
> Hi,
>
> We are using varnish 4.1.2 for our website caching. We use bunch of standard
> query parameters (like utm*) to track the channels for our website visits -
> this is quite standard in the web world.

You should upgrade right away to 4.1.8:

https://varnish-cache.org/security/VSV00001.html

> 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?
>
> For example, all the marketing utm_source, utm_campaign, utm_* values don't
> change the content of the page, they just vary a lot from campaign to
> campaign and are used by all of our client-side tracking.
>
> So this also means that the URL can't change on the client side, but it
> should somehow be 'normalized' in the cache.
>
> Essentially I want all of these...
>
> http://example.com/page/?utm_source=google
>
> http://example.com/page/?utm_source=facebook&utm_content=123
>
> http://example.com/page/?utm_campaign=usa
>
> ... to all access HIT the cache for http://example.com/page/
>
> However, this URL would cause a MISS (because the param is not a utm_*
> param)
>
> http://example.com/page/?utm_source=google&variation=5
>
> Would trigger the cache for
>
> http://example.com/page/?variation=5
>
> Also, keeping in mind that the URL the user sees must remain the same, I
> can't redirect to something without params or any kind of solution like
> that.
>
> Would appreciate if you could help me with the above to increase the
> performance of our site.

May I suggest vmod-querystring?

https://github.com/Dridi/libvmod-querystring#vmod-querystring

Dridi


More information about the varnish-misc mailing list