Individual Cache for different Browsers?

Klapproth, Martin Klapproth.M at
Thu Dec 2 13:32:35 CET 2010



I have requested one page with different browsers (firefox, chrome). If
I make a second request with the same browser I get the object from the
varnish cache. But if the first browser makes the first request and the
second browser makes the second one I get a miss.


In my configuration the hash will be determined only by the url and host
header (nothing else). Client side Cache-Control or Pragma headers were
totally ignored. Here a snippet out of my vcl config:


sub vcl_recv {

        unset req.http.Pragma;

        unset req.http.Cache-Control;




sub vcl_hash {

    set req.hash += req.url;

    if (req.url == "/") {

        set req.hash +=;


    return (hash);



sub vcl_deliver {

           if (obj.hits > 0) {

              set resp.http.X-Cache = "HIT";

           } else {

                set resp.http.X-Cache = "MISS";


           unset resp.http.X-Varnish;



Here the 2 browser requests:


Request 1 by Firefox:



User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:
Gecko/20101026 Firefox/3.6.12

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Referer: XXXXX

Cookie: __utma=31143592.1898076621.1291293810.1291291810.1291291810.1;
__utmb=31173592; __utmc=31543592;
one); __utma=61459198.633465754.1291291861.1291241861.1291291861.1;
__utmb=6145912.2.10.1291291861; __utmc=61459198;


Response 1 (Request made by Firefox)


Server: nginx

Date: Thu, 02 Dec 2010 12:11:26 GMT

Content-Type: text/html; Charset=utf-8

Connection: keep-alive

Keep-Alive: timeout=20

Cache-Control: public, max-age=600

Expires: Thu, 02 Dec 2010 12:21:26 GMT

Last-Modified: Thu, 02 Dec 2010 12:11:26 GMT

CacheInfo: 600

Content-Encoding: gzip

X-Cache: MISS           // that's ok, cause the object wasn't cached

Content-Length: 7978

Age: 0


Request 2 by Chrome



User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7


Response 2 by Chrome


Age: 0

Cache-Control: public, maxage=600

CacheInfo: 600

Connection: keep-alive

Content-Encoding: gzip

Content-Length: 8004

Content-Type: text/html; Charset=utf-8

Date: Thu, 02 Dec 2010 12:11:56 GMT

Expires: Thu, 02 Dec 2010 12:21:56 GMT

Keep-Alive: timeout=20

Last-Modified: Thu, 02 Dec 2010 12:11:56 GMT

Server: nginx

X-Cache: MISS     // That's not ok, cause the request was done 30 sec
after the first one ant the max-age is 600


The nginx is only proxying the request to varnish and handles gzip. The
object will be cached (can see it in varnishlog).


Can you help me with my problem?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list