Varnish chunks response with esi-fragments

Michael Borejdo mib at
Wed Dec 14 14:14:17 CET 2011

Hi list,
being new to varnish and http-caching in general, i have a few questions, i'd love to ask.

My Setup:
varnish [3.0.2] (80) <-> nginx (8080) [1.1.10] <-> php-fpm (9000)
(same behaviour using static html only)

I have a page (/outer.html) with two esi-fragments. (esi:include tags). (/inner.html)

I expect varnish to (very simplified):

- receive a request for /outer.html
- recognize and parse the esi-tags in /outer.html
- do two additional requests to fetch the esi-srcs (inner.html)
- respond with the assembled page.

Varnish is sending a response, which has no content-length, hence the Transfer-Encoding is chunked.
In my current setup, outer.html loads and the (correctly evaluated) esi-tags appear one after another in the chunked response.

Q) Why is varnish not buffering the response and sending it "as a whole" to the client, but chunking the response?
Q) Is this the expected behaviour?
Q) How can i prevent the chunked response but tell varnish to buffer the whole page (including its esi-fragments) and send it fully to the client?
I can provide the logs for all layers, if this will help

More information about the varnish-misc mailing list