I have a system which is load balancing via a cookie, but I want to use a URL parameter as an alternative. (Specifically, I have a front end app which does not support cookies). My setup is a little complex - I have a multiplayer system and I use a stick table with this cookie to make sure different people playing the same game go to the same server. This works great, except that the URL parameters don't seem to do anything. This is all with haproxy 1.5dev17
My relevant backend is:
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
option http-server-close
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
backend simulate
option httpchk OPTIONS /simulate/api/status
stick-table type string len 40 size 5M expire 30m
stick store-response set-cookie(SIMULATE_STICKY_SESSION) table simulate
stick on cookie(SIMULATE_STICKY_SESSION) table simulate
stick on url_param(SIMULATE_STICKY_SESSION) table simulate
server app1 10.0.2.11:8080 cookie app1 check inter 10000
server app2 10.0.3.11:8080 cookie app2 check inter 10000
Note that SIMULATE_STICKY_SESSION is generated by my app (based on player team).
When I call the URL, I need to pass a jsessionid (so that Tomcat will find the correct session). So I am doing
This doesn't seem to be picking up the sticky session parameter as 50% of the time it goes to the wrong server. I tried using the param as a query string (after a ? mark) but that didn't work either. What am I doing wrong?
A response was provided here on the haproxy mailing list
excerpt