Mailing List Archive

Optimal way to handle Vary on User-Agent
Hi,

We are using Varnish 4.1.8 to cache and speed up our web delivery. Our
page content varies based on following 3 device types:

1. Desktop
2. Mobile (doesn't matter whether android, iOS or windows)
3. Tablet

As universally known, varying on User-Agent is quite bad for caching as
there would be thousands of UA. Hence, would like to know a solution
based on following if possible in Varnish:

1. Normalize header User-Agent to only the 3 types mentioned above OR
2. Add a new normalized HTTP header for the above 3 types. Our backed
then Vary on the new HTTP header.

Would appreciate if any solution could be provided for the above..

Thanks,

Pinakee
Re: Optimal way to handle Vary on User-Agent [ In reply to ]
The user-agent is an abomination and needs to die.

Now, with that being said, I would rewrite the UA header, just to make sure
the backend doesn't use the original information.

You can have a look at https://github.com/varnishcache/varnish-devicedetect
for a vcl solution. Other solutions exist, obviously.

--
Guillaume Quintard

On Fri, Oct 13, 2017 at 2:19 PM, Pinakee BIswas <pinakee@waltzz.com> wrote:

> Hi,
>
> We are using Varnish 4.1.8 to cache and speed up our web delivery. Our
> page content varies based on following 3 device types:
>
> 1. Desktop
> 2. Mobile (doesn't matter whether android, iOS or windows)
> 3. Tablet
>
> As universally known, varying on User-Agent is quite bad for caching as
> there would be thousands of UA. Hence, would like to know a solution based
> on following if possible in Varnish:
>
> 1. Normalize header User-Agent to only the 3 types mentioned above OR
> 2. Add a new normalized HTTP header for the above 3 types. Our backed
> then Vary on the new HTTP header.
>
> Would appreciate if any solution could be provided for the above..
>
> Thanks,
>
> Pinakee
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>