[Varnish] #887: Varnish caches objects with negative max-age

Varnish varnish-bugs at varnish-cache.org
Wed Mar 30 17:36:52 CEST 2011


#887: Varnish caches objects with negative max-age
-------------------------------------------+--------------------------------
 Reporter:  niko                           |        Type:  defect
   Status:  new                            |    Priority:  high  
Milestone:                                 |   Component:  build 
  Version:  trunk                          |    Severity:  normal
 Keywords:  negative max-age, past expire  |  
-------------------------------------------+--------------------------------
 Varnish caches objects with negative max-age and/or (?) past expire
 header.

 I'm using varnishd (varnish-trunk revision 5ec2bb0).

 To debug I set a X-TTL header:

 {{{
 sub vcl_fetch {
   set beresp.http.X-TTL = beresp.ttl;
 }
 }}}

 Here is an example request:

 {{{
 curl -i localhost:8080/station/eins-test/current_song
 HTTP/1.1 200 OK
 Status: 200 OK
 Content-Type: application/json; charset=utf-8
 Cache-Control: public, must-revalidate, max-age=-1301498973
 Expires: Thu, 01 Jan 1970 00:00:00 GMT
 X-TTL: 2993468323.000
 Content-Length: 0
 Accept-Ranges: bytes
 Date: Wed, 30 Mar 2011 15:29:33 GMT
 X-Varnish: 2019167673
 Age: 0
 Via: 1.1 varnish
 Connection: keep-alive
 X-Cache: MISS
 }}}

 Subsequent requests look as follows:

 {{{

 curl -i localhost:8080/station/eins-test/current_song
 HTTP/1.1 200 OK
 Status: 200 OK
 Content-Type: application/json; charset=utf-8
 Cache-Control: public, must-revalidate, max-age=-1301498973
 Expires: Thu, 01 Jan 1970 00:00:00 GMT
 X-TTL: 2993468323.000
 Content-Length: 0
 Accept-Ranges: bytes
 Date: Wed, 30 Mar 2011 15:31:42 GMT
 X-Varnish: 2019167674 2019167673
 Age: 129
 Via: 1.1 varnish
 Connection: keep-alive
 X-Cache: HIT
 X-Cache-Hits: 1
 }}}

 My workaround for now is this VCL rule:

 {{{
 sub vcl_fetch {
   set beresp.http.X-TTL = beresp.ttl;
   if (beresp.http.Cache-Control ~ "max-age=-") {
     return(hit_for_pass);
   }
 }
 }}}

 I have attached my complete VCL.

-- 
Ticket URL: <http://varnish-cache.org/trac/ticket/887>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list