Hello,<br><br>I am experimenting with ESI.<br><br>I am wondering how I can handle propagating status codes to the parent(root) request?<br><br>The problem is that an esi subrequest might return a 4xx, 5xx status however the status does not propagate to the root request.<br>
<br>I think what I would like is the ability to merge headers (overwrite) between esi subrequest and a parent request.<br><br>Thanks,<br>John<br><br>Take this for example:<br><br>t.php:<br><?php<br><br>header("Cache-Control: no-cache, must-revalidate\n");<br>
header("x-do-esi: true\n");<br><br>print("<html><head></head><<div id=":136">body><p> t1");<br>print("<div
style='outline:#00FF00 dotted thick; width:1024px; height:80px'>
<esi:include src='/t1.php' /></div>");<br>
<br>?><br><br><br>t1.php:<br><?php<br><br>header("Cache-Control: no-cache, must-revalidate\n");<br>header("x-esi-response: true\n");<br>header("HTTP/1.0 404 Not Found");<br><br>print("t1 sent a 404\n");<br>
<br>?><br><br><br>vcl:<br>backend default {<br> .host = "localhost";<br> .port = "80";<br>}<br><br>backend test {<br> .host = "localhost";<br> .port = "80";<br>}<br>
<br>
sub vcl_recv {<br> remove req.http.Accept-Encoding;<br> set req.http.x-saved-status = 1;<br><br> if (req.request == "GET") {<br> if (req.url == "/t1.php") {<br> set req.backend = test;<br>
}<br> return(pass);<br> } <br><br>}<br><br><br>sub vcl_fetch {<br> if (beresp.http.x-do-esi) {<br> set beresp.do_esi = true;<br> set req.http.x-saved-status = beresp.status;<br> }<br>
<br> if (beresp.http.x-esi-response) {<br> if(beresp.status != 200 ) {<br> set req.http.x-saved-status = beresp.status;<br> }<br> }<br><br> if ( beresp.http.Pragma ~ "no-cache"<br>
|| beresp.http.Cache-Control ~ "no-cache"<br> || beresp.http.Cache-Control ~ "private") {<br> return(hit_for_pass);<br> }<br><br>}<br><br>sub vcl_deliver {<br> set resp.http.status = req.http.x-saved-status;<br>
}</div>