[Varnish] #1766: Provide an access to the request stack for ESI subrequests

Varnish varnish-bugs at varnish-cache.org
Mon Jul 20 12:49:37 CEST 2015


#1766: Provide an access to the request stack for ESI subrequests
---------------------------------+-------------------------
 Reporter:  lisachenko.it@…      |       Type:  enhancement
   Status:  new                  |   Priority:  normal
Milestone:                       |  Component:  varnishd
  Version:  4.0.3                |   Severity:  normal
 Keywords:  ESI, request, stack  |
---------------------------------+-------------------------
 In some cases, this feature can be very useful with combination of
 req.esi_level variable.

 For example, to detect Last-Modified date for a page with ESI blocks (we
 just update the main response header within sub-responses).

 Here is an example:

 {{{

 req.stack     <== Stack of requests and subrequests
 req.stack[0]  <== Always first, main request
 req.stack[req.esi_level-1] <== Parent request for the current ESI sub-
 request.

 resp.stack    <== Stack of responses
 resp.stack[0] <== Main response

 if (req.esi_level > 0 && (!resp.stack[0].http.Last-Modified ||
 resp.stack[0].http.Last-Modified < resp.http.Last-Modified)) {
     // Update our main response headers with information about current
 response
     set resp.stack[0].http.Last-Modified = resp.http.Last-Modified;
 }

 }}}

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1766>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator



More information about the varnish-bugs mailing list