From: Willy Tarreau Date: Tue, 22 Sep 2026 19:46:38 +0000 (+0000) Subject: REGTESTS: proxy: test the disable-l7-retry action X-Git-Tag: v3.5-dev8~27 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=ef1ab4a67e9104193d7930cb537e7ec66f7feb10;p=haproxy.git REGTESTS: proxy: test the disable-l7-retry action The action had no coverage, and the notes listed adding a fourth backend here as the way to get it. That backend is a copy of the one which retries on a 503, with "disable-l7-retry" in an http-request rule: the 503 of the first server must then reach the client as it is, with txn.conn_retries left at zero, and the second server must not be contacted at all. --- diff --git a/reg-tests/proxy/retry_on.vtc b/reg-tests/proxy/retry_on.vtc index b035e92f4..bd8b1021d 100644 --- a/reg-tests/proxy/retry_on.vtc +++ b/reg-tests/proxy/retry_on.vtc @@ -4,10 +4,11 @@ varnishtest "Test the connection retries, retry-on and option redispatch" # txn.conn_retries and txn.redispatched fetches which report their # effect were not covered either. # -# Three backends are used: one whose only server is unreachable, one +# Four backends are used: one whose only server is unreachable, one # which redispatches to a healthy server after the first attempt fails, -# and one which retries at the HTTP layer when the server answers with a -# 503. +# one which retries at the HTTP layer when the server answers with a +# 503, and a copy of the latter where the "disable-l7-retry" action +# cancels that retry. feature ignore_unknown_macro @@ -26,6 +27,11 @@ server s3 { txresp -hdr "x-second: yes" } -start +server s4 { + rxreq + txresp -status 503 +} -start + haproxy h1 -conf { global .if feature(THREAD) @@ -43,6 +49,7 @@ haproxy h1 -conf { bind "fd@${fe}" use_backend redisp if { path /redisp } use_backend l7 if { path /l7 } + use_backend nol7 if { path /nol7 } default_backend dead http-after-response set-header x-retries "%[txn.conn_retries]" @@ -74,6 +81,17 @@ haproxy h1 -conf { option redispatch server bad ${s2_addr}:${s2_port} server good ${s3_addr}:${s3_port} + + # same, but an http-request rule disables the L7 retry, so the 503 is + # delivered as it is and the second server is never contacted + backend nol7 + balance first + retries 1 + retry-on 503 + option redispatch + http-request disable-l7-retry + server bad ${s4_addr}:${s4_port} + server good ${s3_addr}:${s3_port} } -start client c1 -connect ${h1_fe_sock} { @@ -104,3 +122,13 @@ client c3 -connect ${h1_fe_sock} { expect resp.http.x-retries == "1" expect resp.http.x-redisp == "1" } -run + +client c4 -connect ${h1_fe_sock} { + # "disable-l7-retry" leaves the 503 of the first server untouched + txreq -url "/nol7" + rxresp + expect resp.status == 503 + expect resp.http.x-second == "" + expect resp.http.x-retries == "0" + expect resp.http.x-redisp == "0" +} -run