ESI works in IE6 & curl, but not in FF, Opera, Konqueror

Torstein Krause Johansen torstein at escenic.com
Thu Nov 6 10:20:46 CET 2008


Hi all,

I cannot get ESI to work for any "real" browser, it might be something 
really obvious I've missed, but it seems really odd to me.

My VCL:
backend default {
     .host = "127.0.0.1";
     .port = "81";
}

sub vcl_fetch {
     if (req.url ~ "esiTest.html") {
         esi;
         set obj.ttl = 24 h;
     }
     elseif (req.url == "/cgi-bin/date.cgi") {
         set obj.ttl = 1m;
     }
}

esiTest.html (copied from varnish web site):
<html xmlns="http://www.w3.org/1999/xhtml">
   <body>
     The time is: <esi:include src="/cgi-bin/date.cgi"/>
     at this very moment.
   </body>
</html>

date.cgi (copied from varnish web site):
#!/bin/sh

echo 'Content-type: text/html'
echo ''
date "+%Y-%m-%d %H:%M"

I've included everything here so you can see there's no copy/paste 
errors :-) Backend is Apache HTTPd 2.2.

Now to the odd bit, this works in IE6, curl and wet, but not in browsers 
like Firefox (Iceweasel), Konqueror or Opera.

It seems that the "Accept-encoding" header the client sends (or doesn't 
send in curl's case) to Varnish is the crucial bit, but of course I'm 
not sure. It _does_ influence the curl result though, setting it to the 
same as what Iceweasel sends to Varnish messes up the results (only 
garble comes back).

Here's the output from when Iceweasel tries to access the esiTest.html 
page: http://pastebin.com/m5f659a20

And here's the output from curl, which works:
http://pastebin.com/m504fd0b0


So, please tell me what I need to do to make this work, and no, using IE 
is not an option ;-)

Best regards,

-Torstein




More information about the varnish-misc mailing list