I am having problems getting even the simplest of Varnish Cache
ESI tests to work.
After trying and trying I thought I ask here.
Basically it just wont include the ESI file. It's just returning the HTML without doing it's include.
Here is my varnish start command:
varnishd -f /etc/varnish/default.vcl -s malloc,128M -T 127.0.0.1:2000 -a 0.0.0.0:8080;
Here is the URL I'm testing with:
http://vbox.local:8080/varnish-tests/test.php
My vcl rules:
1) default.vcl
backend default {
.host = "127.0.0.1";
.port = "80";
}
sub vcl_fetch {
if (req.url ~ "test.php") {
esi; /* Do ESI processing */
set beresp.ttl = 24h;
} elseif (req.url ~ "esi_1.php") {
set beresp.ttl = 1m;
}
return(deliver);
}
My sample test esi code
2) test.php
<html>
<head>
<?php echo "Time 1: ".time(); ?>
<br />
The time 2 is: <esi:include src="/varnish-tests/esi_1.php"/> at this very moment.
</body>
</html>
The php to esi include
3) esi_1.php
<?php
echo "Time 2: ".time();
?>
I've tried many variations of the above vcl rules.
All don't work. Just can't see where I'm going wrong?
Any advise/help much appreciated.
Thank you.