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.
This commit is contained in:
Aurelien DARRAGON 2023-06-20 15:02:11 +02:00 committed by Christopher Faulet
parent d35cee972b
commit b973980853
1 changed files with 11 additions and 0 deletions

View File

@ -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} {