[Varnish] #122: Varnish caches wrong resources

Varnish varnish-bugs at projects.linpro.no
Fri Jun 29 18:37:56 CEST 2007

#122: Varnish caches wrong resources
 Reporter:  RuddO     |        Owner:  phk          
     Type:  defect    |       Status:  reopened     
 Priority:  normal    |    Milestone:  Varnish 1.0.4
Component:  varnishd  |      Version:  trunk        
 Severity:  normal    |   Resolution:               
 Keywords:            |  
Comment (by RuddO):

 Instead of defaulting to 120s if no headers are present, it must by
 default not cache stale objects or objects without caching headers, and
 cache objects with only Last-Modified headers using an adaptive TTL.
 Static files served by Apache always have last-modified headers, so it's
 sensible to use this approach (plus, you have the ETag thingie that Apache
 returns).  Dynamic PHP/CGI/Python scripts (configured not to send any
 uncaching headers) on the other hand must never be cached because the
 freshness of the page is *uncertain*.  Those scripts that actually send
 headers saying "hey, cache me, man", they must be cached.

 That is, an object should be marked cacheable by adaptive TTL *only* if it
 has a Last-Modified header (see the cacheability engine for more info), or
 if it has an Expires header (in which case it shouldn't use an adaptive
 TTL, it should rather use the explicit Expires time).

 And the -t option should enable the current default behavior of assigning
 N second TTL.  And this particular behavior should be documented in big
 red typeface on the front page or the varnish docs.

 So, if I use -t 0, then nothing gets cached unless an Expires header is
 present?  Doesn't really make sense, since the sensible default would be
 an adaptive TTL based on Last-Modified to cache static files transparently
 (you know, Apache doesn't serve them with Expires: headers).

Ticket URL: <http://varnish.projects.linpro.no/ticket/122#comment:6>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list