Hello, Varnish folks! I am currently in the process of testing the ESI
features of Varnish. I have discovered that if I place more than one
on a document, any includes beyond the first are inserted
to the cache, but never hit on subsequent requests. I have tried to
determine if this is caused by something in my configuration but have
been unable to locate anything. I have distilled my test case down to
something which ought to be reproducible.
We are running varnish-trunk, latest revision within a week or so.
ESI is being triggered off the filename, for simplicity sake, as such:
sub vcl_fetch {
remove obj.http.Set-Cookie;
if (req.url ~ "esi\.html$") {
esi;
}
}
varnish is being tested by several users on the server simultaneously,
using different non-privileged usernames and instance names (via -n).
See attached:
1) varnish_esi_case.txt, showing the contents of the source files,
detailed headers for all objects. Demonstrates that on two subsequent
requests, the max-age on the second include is not honored
2) varnish_varnishlog_output.txt, showing the output of varnishlog
(excliding ping/PONG) though a purge, and then both requests to the
ESI-enabled document.
An observation, which could easily be a mis-correlation: second and
subsequent requests for esi fragments are logged with an 'XID' of '0'. I
do not know if this is intentional or perhaps indicative of the
underlying problem.
Thanks for any insight you can provide!
--
JT Justman
End Point Corporation
http://www.endpoint.com
$ cat cgi-bin/date-5.cgi
#!/usr/local/bin/perl
use DateTime;
print "Content-Type: text/html; charset=iso-8859-1\nCache-Control:
max-age=5\n\n";
print DateTime->now();
print "\n";
$ ./date-5.cgi
Content-Type: text/html; charset=iso-8859-1
Cache-Control: max-age=5
2008-05-09T18:01:05
$ ./date-20.cgi
Content-Type: text/html; charset=iso-8859-1
Cache-Control: max-age=20
2008-05-09T18:01:12
$ lwp-request -U -s -e http://localhost:9138/cgi-bin/date-20.cgi
GET http://localhost:9138/cgi-bin/date-20.cgi
User-Agent: lwp-request/2.08
200 OK
Cache-Control: max-age=20
Connection: close
Date: Fri, 09 May 2008 18:02:31 GMT
Via: 1.1 varnish
Age: 0
Server: Apache
Content-Length: 20
Content-Type: text/html; charset=iso-8859-1
Client-Date: Fri, 09 May 2008 18:02:30 GMT
Client-Peer: 127.0.0.1:9138
Client-Response-Num: 1
P3P: CP="IND NON DSP PHY ONL UNI FIN PUR COM INT DEM CNT STA PRE POL CUR ADMa
PSAo PSDo IVAo IVDo CONo OUR", policyref="http://localhost:9138/w3c/p3p.xml";
X-Varnish: 1887710906
2008-05-09T18:02:31
$ lwp-request -U -s -e http://localhost:9138/cgi-bin/date-5.cgi
GET http://localhost:9138/cgi-bin/date-5.cgi
User-Agent: lwp-request/2.08
200 OK
Cache-Control: max-age=5
Connection: close
Date: Fri, 09 May 2008 18:03:13 GMT
Via: 1.1 varnish
Age: 0
Server: Apache
Content-Length: 20
Content-Type: text/html; charset=iso-8859-1
Client-Date: Fri, 09 May 2008 18:03:13 GMT
Client-Peer: 127.0.0.1:9138
Client-Response-Num: 1
P3P: CP="IND NON DSP PHY ONL UNI FIN PUR COM INT DEM CNT STA PRE POL CUR ADMa
PSAo PSDo IVAo IVDo CONo OUR", policyref="http://localhost:9138/w3c/p3p.xml";
X-Varnish: 1887710907
2008-05-09T18:03:13
$ cat html/test_esi.html
This document will use the default TTL.
Here is an ESI include with a five second timeout:
Here is an ESI include with a twenty second timeout:
$ lwp-request -U -s -e http://localhost:9138/test_esi.html
GET http://localhost:9138/test_esi.html
User-Agent: lwp-request/2.08
200 OK
Connection: close
Date: Fri, 09 May 2008 18:16:12 GMT
Via: 1.1 varnish
Age: 0
ETag: "cc135-10d-18c031c0"
Server: Apache
Content-Type: text/html; charset=iso-8859-1
Last-Modified: Fri, 09 May 2008 18:09:19 GMT
Client-Date: Fri, 09 May 2008 18:16:12 GMT
Client-Peer: 127.0.0.1:9138
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
P3P: CP="IND NON DSP PHY ONL UNI FIN PUR COM INT DEM CNT STA PRE POL CUR ADMa
PSAo PSDo IVAo IVDo CONo OUR", policyref="http://localhost:9138/w3c/p3p.xml";
X-Varnish: 1887710915
This document will use the default TTL.
Here is an ESI include with a five second timeout: 2008-05-09T18:16:12
Here is an ESI include with a twenty second timeout: 2008-05-09T18:16:12
$ lwp-request -U -s -e http://localhost:9138/test_esi.html
GET http://localhost:9138/test_esi.html
User-Agent: lwp-request/2.08
200 OK
Connection: close
Date: Fri, 09 May 2008 18:16:14 GMT
Via: 1.1 varnish
Age: 2
ETag: "cc135-10d-18c031c0"
Server: Apache
Content-Type: text/html; charset=iso-8859-1
Last-Modified: Fri, 09 May 2008 18:09:19 GMT
Client-Date: Fri, 09 May 2008 18:16:14 GMT
Client-Peer: 127.0.0.1:9138
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
P3P: CP="IND NON DSP PHY ONL UNI FIN PUR COM INT DEM CNT STA PRE POL CUR ADMa
PSAo PSDo IVAo IVDo CONo OUR", policyref="http://localhost:9138/w3c/p3p.xml&q