[Varnish] #92: VCL-check for purge prevents caching
Varnish
varnish-bugs at projects.linpro.no
Wed Mar 21 14:18:55 CET 2007
#92: VCL-check for purge prevents caching
----------------------+-----------------------------------------------------
Reporter: stonor | Owner: phk
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishd | Version:
Severity: normal | Keywords:
----------------------+-----------------------------------------------------
I don't know if this is a bug or my lack of vcl knowledge, so here we go:
I want this behavior: When somebody hits <ctrl>-F5 in a browser, varnish
will purge the current page from the cache.
Firefox puts this in its request header when you do that:
Cache-Control: no-cache
So I inserted this piece of vcl:
--
sub vcl_hit {
if(req.http.Cache-Control == "no-cache") {
set obj.ttl = 0s;
error 200 "Hey, we got a purge";
}
}
--
At first glance that kind of works. When somebody hits <ctrl>-F5 the page
gets purged and I get my custom error message.
However suddenly the page is not served from the cache _at all_. That is
unless I just hit F5, _then_ I get a cached page. Hitting F5 sends this
request header in Firefox:
Cache-Control: max-age=0
I don't send any caching headers on the backend if that matters, just
relying on the default Varnish fallback to 120 sec.
--
Ticket URL: <http://varnish.projects.linpro.no/ticket/92>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list