I have set up locally Varnish and have implemented an ESI fragment on a specific area of the page; but as soon as I turn on ESI on the default.vcl, varnish stops caching and even more, that specific section of the page where the fragment is added, renders a 503 service unavailable notice instead.
The line that seems to make varnish stop caching is the else statement here:
if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
unset beresp.http.set-cookie;
set beresp.ttl = 20m;
}
else {
set beresp.do_esi = true;
}
Here is my default.vcl: http://pastebin.com/MEQF4Gbk
Now, in the RxHeaders I get a lot of "ESI_xmlerror c No ESI processing, first char not '<'"
Here a sample of one of the RxHeaders (for a JS file) http://pastebin.com/tX7zpBN1
I guess, I'm not understanding how am suppose to tell varnish to cache only when it has esi fragment? Can someone explain what I'm doing wrong?