Trouble understanding Varnishlog
Flavio Torres
fla_torres at yahoo.com.br
Tue Jan 4 13:22:26 CET 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/04/2011 02:31 AM, . wrote:
> I'm using HTTP/1.1, so I don't believe that is the issue.
>
Hello!
I?m sorry I miscommunicated to you, I told u about HTTP/1.1 because
your header says: 'Cache-Control: private, max-age=0, must-revalidate'
and varnish should respect cache requests with private or max-age=0.
> Any idea why X-Varnish would indicate a cache miss by not
> specifying
2 numbers?
I suggest you the following vcl:
# for security reasons :)
acl header {
"localhost";
}
# vcl_deliver
sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
if (client.ip ~ header) {
set resp.http.X-Served-By = server.hostname;
set resp.http.X-Client-IP = client.ip;
set resp.http.X-Cache-Hits = obj.hits;
} else {
unset resp.http.X-Server-ID;
}
# set resp.http.X-Cache-Hits = obj.hits;
set resp.http.X-Age = resp.http.Age;
unset resp.http.Age;
remove resp.http.X-Varnish;
remove resp.http.Via;
}
And try:
$ curl -I -H "Host: www.yourdomain.com"
http://localhost/upload/canal/22/topo.jpg
HTTP/1.1 200 OK
Last-Modified: Fri, 22 Oct 2010 15:02:47 GMT
Cache-Control: max-age=86400, public
Expires: Tue, 04 Jan 2011 12:15:32 GMT
X-SID: 01
Content-Type: image/jpeg
VID: 01
Content-Length: 5291
Date: Tue, 04 Jan 2011 12:11:59 GMT
Connection: keep-alive
X-Cache: HIT # HIT lol
X-Served-By: cache-01.oi.com.br
X-Client-IP: 127.0.0.1
X-Cache-Hits: 1355 # hits
X-Age: 86187
hope this helps
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0jEP8ACgkQNRQApncg296FcgCgsYOzbKHtR76n+GEHltsGt+RG
i40An3RBL5/rOOkumISEKFE1q8v24YcP
=nTOZ
-----END PGP SIGNATURE-----
More information about the varnish-misc
mailing list