From: Aurelien DARRAGON Date: Tue, 20 Jun 2023 13:02:11 +0000 (+0200) Subject: REGTEST: add an extra testcase for ifnone-forwardfor X-Git-Tag: v2.9-dev1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9739808535d417ad827e6ebd3d664562f1d6b03;p=thirdparty%2Fhaproxy.git REGTEST: add an extra testcase for ifnone-forwardfor In GH #2187 it was mentioned that the ifnone-forwardfor regtest did not cover the case where forwardfor ifnone is explicitly set in the frontend but forwardfor option is not used in the backend. Expected behavior in this case is that the frontend takes the precedence because the backend did not specify the option. Adding this missing case to prevent regressions in the future. --- diff --git a/reg-tests/http-rules/ifnone-forwardfor.vtc b/reg-tests/http-rules/ifnone-forwardfor.vtc index 87f5d38271..4be82ac2f9 100644 --- a/reg-tests/http-rules/ifnone-forwardfor.vtc +++ b/reg-tests/http-rules/ifnone-forwardfor.vtc @@ -24,6 +24,7 @@ haproxy h1 -conf { option forwardfor if-none use_backend be1 if { path /req1 } use_backend be2 if { path /req2 } + use_backend be3 if { path /req3 } frontend normal bind "fd@${normal}" @@ -44,6 +45,9 @@ haproxy h1 -conf { backend be2 option forwardfor if-none server s1 ${h1_fe2_addr}:${h1_fe2_port} + + backend be3 + server s1 ${h1_fe2_addr}:${h1_fe2_port} } -start client c1 -connect ${h1_none_sock} { @@ -67,6 +71,13 @@ client c1 -connect ${h1_none_sock} { expect resp.status == 200 expect resp.http.x-ff == 1 + txreq -req GET -url /req3 \ + -hdr "x-src: 10.0.0.128" \ + -hdr "x-forwarded-for: 127.0.0.1" + rxresp + expect resp.status == 200 + expect resp.http.x-ff == 1 + } -run client c1 -connect ${h1_normal_sock} {