Caching same object twice for different browsers

Lars Jørgensen lajo at kb.dk
Wed Jul 13 16:27:40 CEST 2011


> We are using the following vcl (varnish 2.1):
> 
> sub vcl_hash {
> 
>         if (req.http.user-agent ~ "iPhone|SymbianOS") {
>                 set req.hash += req.http.user-agent;
>         }
>         else {
>                 remove req.http.user-agent;
>         }
> 
>         set req.hash += req.url;
>         set req.hash += req.http.host;
> 
>         return (hash);
> }
> 
> 
> Hope this helps.

It sure does, thank you. And if I don't care about user-agents at all (AFAIK the CMS always delivers the same page), I can do something like the code below?

sub vcl_recv {
  ...
  remove req.http.user-agent;
  ...
}

If I do that, will varnishncsa still log user-agents?


-- 
Lars






More information about the varnish-misc mailing list