inspect the response header to find cached request

Stewart Robinson stewsnooze at
Tue Feb 22 11:18:17 CET 2011


You could change your vcl_deliver function in your vcl to have
something like this.

sub vcl_deliver {
	if (obj.hits > 0) {
		set resp.http.X-Cache-Action = "HIT";
		set resp.http.X-Cache-Hits = obj.hits;
	} else {
		set resp.http.X-Cache-Action = "MISS";

This works on the 2.0x series. Can't remember off the top of my head
whether vcl_deliver has renamed obj to something else.

Stewart Robinson

On 22 February 2011 10:10, Junxian Yan <junxian.yan at> wrote:
> Is there any parameters to determine if some request has been cached by
> varnish when inspect the response header
> Junxian
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at

More information about the varnish-misc mailing list