ESI includes don't account for manually timed out files

David Helkowski dhelkowski at sbgnet.com
Mon Feb 7 16:02:39 CET 2011


I have noticed what seems to be a bug in varnish. If anyone has 
experience with using ESI and timing things out from the cache manually 
at the same time, please take a look at this and, if it is not a bug, 
take a moment to explain what I am missing.

I have ESI setup in varnish. I have a file 'a.ehtml' that includes 
'b.html' via an ESI include. I have my hit function setup to do 'set 
obj.ttl=0s' when a 'no-cache' request is sent in.

If I make a request to b.html to reset it via 'no-cache' ( shift-refresh 
from my browser ), 'a.ehtml' still continues to be cached for the 
original ttl of 'b.html' before I set it to 0.

That is:
1. b.html contains '1'
2. a.ehtml shows '1' in the browser ( it includes b )
3. change the contents of b.html to '2'
4. shift-refresh b.html to force it to update in the cache
5. b.html now shows '2' in a browser
6. a.ehtml continues to show '1' ( until time length of original timeout 
of b.html passes )

The relevant portion of vcl_hit:
if( req.http.Cache-Control == "no-cache" ) {
   if (! (req.http.User-Agent ~ "bot|MSIE") ) {
     set obj.ttl = 0s; return(restart);
   }
}

The revelant portion of vcl_fetch:
if( req.url ~ "\.ehtml$" || beresp.http.Content-Type == "text/ehtml" ) {
   set beresp.http.Content-Type = "text/html";
   esi;
}





More information about the varnish-misc mailing list