Modification of parent response object from the ESI subrequests

Dridi Boukelmoune dridi at varni.sh
Mon Aug 3 19:36:11 CEST 2015


On Mon, Aug 3, 2015 at 5:00 PM, Alexander Lisachenko
<lisachenko.it at gmail.com> wrote:
> Hello, dev team!
>
> I want to continue the discussion of issue
> https://www.varnish-cache.org/trac/ticket/1766

FYI I haven't followed this discussion.

> I think, that this feature can be very useful for many purposes, like
> automatic calculation of last-modified dates for conditional responses,
> propagation of statuses from ESI blocks in addtional headers, for example
> X-1-Status: 200 OK, X-2-Status: 404 Not Modifed and much more.

You can't add headers, because esi tags are monitored while the body
is being served. Which means that the headers are already sent by the
time an ESI request is created VCL-wise.

> I know, that the Varnish streams the context as it fetched, but is it
> possible to organize a temporary buffer for the response to buffer it and to
> deliver the whole response to the client, while having an access to the
> parent block from ESI?

That might be a case for a VDP, you could maybe write a VMOD that
pushes an action to the delivery pipeline on ESI requests, and there,
intercept the response headers and body, buffer them, and get a chance
to inject headers during ESI sub-request processing.

ESI is not my sweet-spot so I have really no idea whether that can be
done at all.

Best Regards,
Dridi



More information about the varnish-dev mailing list