Varnish chunks response with esi-fragments

Tollef Fog Heen tfheen at varnish-software.com
Thu Dec 15 10:35:41 CET 2011


]] Michael Borejdo

> Q) Why is varnish not buffering the response and sending it "as a whole" to the client, but chunking the response?

Because that works better with how Varnish works internally.

> Q) Is this the expected behaviour?

Yes.

> 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?

Why do you want to do this?  You can do it, but it'll be a bit of a
workaround by doing something like using yourself as a backend for the
ESI-ed request.

I guess something like:

backend myself {
    .host = "localhost";
    .port = "80";
}

sub vcl_recv {
    if (! req.http.x-esi) {
        set req.backend = myself;
        set req.http.x-esi = "yes, please";
    }
}

sub vcl_hash {
    hash_data(req.http.x-esi);
}

sub vcl_fetch {
    if (req.http.x-esi) {
        set beresp.do_esi = true;
    }
}

might work, possibly with some extra fluff to ensure you just use ESI
for the relevant URLs.  Cache efficientcy will also go down this way.

Regards,
-- 
Tollef Fog Heen
Technical lead, Varnish Software
t: +47 21 98 92 64




More information about the varnish-misc mailing list