Created
January 27, 2020 10:48
-
-
Save aondio/07d88b56f1c5a5015f9ee7a02b3b4176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Cut off ESI request should be retried" | |
server s1 { | |
rxreq | |
expect req.url == "/list" | |
txresp -body {<esi:include src="/fragment"/>} | |
rxreq | |
expect req.url == "/fragment" | |
txresp -status 503 | |
# success | |
rxreq | |
expect req.url == "/fragment" | |
txresp -body "subrequest" | |
} -start | |
varnish v1 -vcl+backend { | |
sub vcl_recv { | |
# Track whether we are in ESI mode to know if we should retry 5xx errors | |
if (req.esi_level > 0) { | |
set req.http.doing-esi = "yes"; | |
} | |
} | |
sub vcl_backend_response { | |
# retry backend errors during esi | |
if (bereq.http.doing-esi && beresp.status >= 500) { | |
set beresp.http.LOCATION = "HERE"; | |
return(retry); | |
} | |
set beresp.do_esi = true; | |
} | |
}-start | |
varnish v1 -cli "param.set feature +esi_disable_xml_check" | |
client c1 { | |
txreq -url "/list" | |
rxresp | |
expect resp.status == 200 | |
expect resp.body ~ "subrequest" | |
} -run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment