[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-bugs
Subject:    [Varnish] #92: VCL-check for purge prevents caching
From:       varnish-bugs () projects ! linpro ! no (Varnish)
Date:       2007-03-21 13:18:55
Message-ID: 077.2939a8964d3fa3409d2de4574ce75003 () projects ! linpro ! no
[Download RAW message or body]

#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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic