different clients resulting in misses

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Mon Aug 8 23:28:17 CEST 2011

Hi, first of all I just started using Varnish. I think it's great, but I'm a
bit of a newbie :-)

I installed Varnish 2.1.4-1 on my localhost, which runs Ubuntu 11.04. It
runs on port 8080 and connects to the backend on localhost port 80. I use
the default config, except for that I added an unset.cookie in vlc_recv and
I added the following code from the manual to normalize accept encodings:

    if (req.http.Accept-Encoding) {
       if (req.http.Accept-Encoding ~ "gzip") {
           set req.http.Accept-Encoding = "gzip";
       } elsif (req.http.Accept-Encoding ~ "deflate") {
           set req.http.Accept-Encoding = "deflate";
       } else {
           # unkown algorithm
           remove req.http.Accept-Encoding;

When I start testing in one browser, I successfully start getting hits for
every identical request after the first one, so far so good. However I
noticed that when I open exactly the same url in a different browser/client,
the first request misses again, and then the second and third hit. Same
happens if I try yet another client (I tried firefox, chrome and wget so
far). As said above I tried to rule out cookies and encoding, but no
difference. Below a dump of headers of a typical request to the back-end.

GET /api/json/test?arg1=10&arg2=100 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0
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
Connection: keep-alive
Referer: http://localhost/api
Cookie: ext-username_field=testuser

HTTP/1.1 200 OK
Date: Mon, 08 Aug 2011 21:03:30 GMT
Server: Apache/2.2.17 (Ubuntu)
Cache-Control: max-age=60, public
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 97
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain

Any suggestions to what could possibly cause that results are only cached on
a per-client basis, rather than globally? Is there any config I could use
that everything is cached according to the URL? My backend API really
doesn't care about anything else; Cookies, Authorization, User-agents are
all ignored, it only looks at the url.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110808/c3e0f282/attachment-0003.html>

More information about the varnish-misc mailing list