BUG/MINOR: server: fix persistence cookie for dynamic servers
authorDamien Claisse <d.claisse@criteo.com>
Wed, 27 Mar 2024 14:34:25 +0000 (14:34 +0000)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 28 Mar 2024 10:54:21 +0000 (11:54 +0100)
commit9a0e0d3a19312d00e4dc20e3257e5238961409e7
tree2984d26dd3553956e5e51ac034ee03a6cab856ef
parent250c19032f030a81dca01541e3c2947d117a041c
BUG/MINOR: server: fix persistence cookie for dynamic servers

When adding a server dynamically, we observe that when a backend has a
dynamic persistence cookie, the new server has no cookie as we receive
the following HTTP header:
set-cookie: test-cookie=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Whereas we were expecting to receive something like the following, which
is what we receive for a server added in the config file:
set-cookie: test-cookie=abcdef1234567890; path=/

After investigating code path, srv_set_dyncookie() is never called when
adding a server through CLI, it is only called when parsing config file
or using "set server bkd1/srv1 addr".

To fix this, call srv_set_dyncookie() inside cli_parse_add_server().

This patch must be backported up to 2.4.
src/server.c