Backend stickiness issue [JSON payload srv param requests]

We have an haproxy setup with cookie url_param cookie based backend stickiness. The main issue we are seeing is that our clients are passing the srv param as part of a JSON payload. clients are sending their srv param in the JSON payload and this is causing their request to fail due to requests are passing to different backends. Any help would be greatly appreciated. The backend setup can be find below.

HA-Proxy version 1.5.4

                    balance url_param srv
                    option  httpclose
                    option  redispatch
                    option  forwardfor
                    reqadd  X-Forwarded-Proto:\ https
                    cookie  pxy50 insert indirect nocache secure domain .example.com maxidle 10m
                    server example1 x.x.x.x:8443 check ssl verify none cookie pxy50srv001A
		server example1_8444 x.x.x.x:8444 check ssl verify none cookie pxy50srv001B
                    server example2 x.x.x.x:8443 check ssl verify none cookie pxy50srv002A
                    serverexample2_8444 x.x.x.x:8444 check ssl verify none cookie pxy50srv002B
                    server example4 x.x.x.x:8443 check ssl verify none cookie pxy50srv004A
                    server example4_8444 x.x.x.x:8444 check ssl verify none cookie pxy50srv004B

Hi,

I think you are mixing two different methods for implementing session sticky - balance with a URL param (nothing to do with cookies) and then separately, cookie load balancing with “pxy50” cookie. Which one do you want to use? If it’s url_param then the clients need to change to pass the parameter in the right place. If cookie based, then actually the above config looks right to me - so if it is not working you need to do some tracing of requests to find out why.

hope that’s some help.

  • Adrian
1 Like

Hi Adrian, Thanks for the update. As you said it’s a mixed conf and cookie based loadbalancing is working well. For now we have sorted out the issue. thanks again.