Hey,

I'm also late on writing an article on the blog about this as well...
Could you give a try to the configuration below and report to us whether
its working or not?

simply update the line below in your configuration to:
  stick on url_param(SIMULATE_STICKY_SESSION,;) table simulate

By default, url_param search for a parameter after the question mark (?).
The configuration above overwrite this by looking for your cookie from the
semi-colon (;).

Note: you must be running a recent 1.5dev haproxy, preferably the dev 18.

Baptiste



On Thu, Apr 4, 2013 at 12:08 PM, Will Glass-Husain <[email protected]> wrote:

> Hi,
>
> I've posted a question on Server Fault but as no one has answered I was
> hoping I might be able to get help here.
>
> http://serverfault.com/questions/495049/using-url-parameters-for-load-balancing-with-haproxy
>
> 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
>
>
> http://my.domain.com/myapp/url;SIMULATE_STICKY_SESSION=1918C909D3F30DB09C2F96B75C57D015.app1+jsessionid;jsessionid=1918C909D3F30DB09C2F96B75C57D015.app1
>
> 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?
>
>
> Thanks in advance, WILL
>

Reply via email to