haproxy/reg-tests/connection/dispatch.vtc
Willy Tarreau 5c15ba5eff MEDIUM: proxy: mark the "dispatch" directive as deprecated
As mentioned in [1], the "dispatch" directive from haproxy 1.0 has long
outlived its original purpose and still suffers from a number of technical
limitations (no checks, no SSL, no idle connes etc) and still hinders some
internal evolutions. It's now time to mark it as deprecated, and to remove
it in 3.5 [2]. It was already recommended against in the documentation but
remained popular in raw TCP environments for being shorter to write.

The directive will now cause a warning to be emitted, suggesting an
alternate method involving "server". The warning can be shut using
"expose-deprecated-directives". The rare configs from 1.0 where
"dispatch" is combined with sticky servers using cookies will just
need to set these servers's weights to zero to prevent them from
being selected by the load balancing algorithm. All of this is
explained in the doc with examples.

Two reg tests were using this method, one purposely for this directive,
which now has expose-deprecated-directives, and another one to test the
behavior of idle connections, which was updated to use "server" and
extended to test both "http-reuse never" and "http-reuse always".

[1] https://github.com/orgs/haproxy/discussions/2921
[2] https://github.com/haproxy/wiki/wiki/Breaking-changes
2025-06-26 15:29:47 +02:00

46 lines
879 B
Text

varnishtest "Validate proper operation of the 'dispatch' mode"
feature ignore_unknown_macro
server s1 {
rxreq
txresp
} -start
server s2 {
rxreq
txresp
} -start
haproxy h1 -conf {
global
# this is needed since 3.3, and this test will be removed in 3.5.
expose-deprecated-directives
defaults
log global
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
listen fe_tcp
bind "fd@${fe_tcp}"
mode tcp
dispatch ${s1_addr}:${s1_port}
listen fe_http
bind "fd@${fe_http}"
mode http
dispatch ${s2_addr}:${s2_port}
} -start
client c1 -connect ${h1_fe_tcp_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
client c2 -connect ${h1_fe_http_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -run