mark html with a flag to say it is served via varnish?

Shibashish shib4u at gmail.com
Fri Oct 21 16:21:39 CEST 2011


On Fri, Oct 21, 2011 at 7:38 PM, S Ahmed <sahmed1020 at gmail.com> wrote:

> WHen a page gets cached in varnish, is it possible to have some sort of
> html flag so by looking at the html you can see when it was cached in
> varnish?
>
> e.g.
>
>
> <!-- varnish cached at 20111021 5:44pm -->
>
> I'm using ruby on rails.
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


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

Check the header of the elements (html or jpg or gif, etc) on your website,
u will see something as...

X-Cache HIT
or
X-Cache MISS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111021/74c6d915/attachment-0003.html>


More information about the varnish-misc mailing list