Help with cookie

Hi All,

I have an authentication server in front of my haproxy through which users authenticate and the authentication server sends a cookie in header to haproxy like seg=7769326326921 ( some rando numbers )

How could i capture and use that cookie in haproxy for load balacncing and NOT by creating and inserting my own cookie like below

backend bk_web
balance roundrobin
cookie SERVERID insert indirect nocache
server s1 192.168.10.11:80 check cookie s1
server s2 192.168.10.21:80 check cookie s2

OR

could i capture the value i,e (randomnumbers ) in some variable and use the same as
backend bk_web
balance roundrobin
cookie seg insert indirect nocache
server s1 192.168.10.11:80 check cookie %variable
server s2 192.168.10.21:80 check cookie %variable

Kindly advice

Many Thanks

Hi

@Lukas : Any suggestions please.

Thanks