Varnish & Multibrowser

Cosimo Streppone cosimo at streppone.it
Thu Mar 3 02:22:52 CET 2011


On Thu, 03 Mar 2011 04:17:07 +1100, Roch Delsalle <rdelsalle at gmail.com>  
wrote:

> Hi,
>
> I would like to know how Varnish would behave if a web page is different
> depending on the browser accessing it.

Varnish doesn't know that unless you instruct it to.

> (eg. if a div is hidden for Internet Explorer users)
> Will it cache it randomly or is will it be able to notice the difference

It will cache regardless of the content of the page,
but according to:

1) vcl_hash(), which defaults to URL + cookies I believe
2) HTTP Vary header of the backend response

So basically you have to tell Varnish what you want,
and possibly stay consistent between VCL and how your
designers make different pages for different browsers.

I tried to put together an example based on what we use:

   http://www.varnish-cache.org/trac/wiki/VCLExampleNormalizeUserAgent

YMMV,

-- 
Cosimo




More information about the varnish-misc mailing list