Hi Michael,
On Fri, May 15, 2009 at 11:11:43AM +0200, Michael Rennt wrote:
> Hi,
>
> I'm using haproxy 1.3.15.7 and I'm not sure about how to read the server
> affiliation from the query
> string, when usually it's read from a cookie.
>
> The normal way for clients to connect is a listener group, which distributes
> the client onto one of
> the two servers in this group (affiliation will be prefixed to a cookie). If
> there is no existing
> affiliation is found in the cookie, the client will be round robbed. All of
> this is working pretty good.
>
> Now there's a special case that is happening on logout of a user: An external
> (automated) system is
> sending a http GET request that has the very same "SESSIONID=<cookie
> name>~<cookie string> in the
> query string, but no cookie set.
>
> How would I be able to achieve that haproxy will dispatch this request to the
> server defined by
> "cookie name"?
Haproxy does not look for a server name in the query string.
What appsession is doing is a special case, and the cookie it
finds here must match what it has learned, not a server name.
I would suggest two possibilities :
- either your automated system does not need to connect to a
specific server, and you could simply use appsession without
any other cookie. It will learn the server's response and will
be able to match the cookie in the query string.
- or your automated system explicitly needs to connect to a
specific server, then why not have it simply set the cookie
correctly ?
> This is the current setup for the listener group:
>
> listen mygroup <ip>:80
> mode http
> log /dev/log daemon info
> option httplog
> option dontlognull
> balance roundrobin
>
> cookie SESSIONID prefix nocache
> option httpclose
> option forwardfor
> appsession SESSIONID len 40 timeout 1h
> server server01 10.0.1.10:80 cookie first check inter 5000
> server server02 10.0.1.11:80 cookie second check inter 5000
>
>
> First: appsession doesn't seem to help here, because for "normal" client
> sessions, the session table
> is empty.
>
> I was thinking about using ACLs. But in my understanding, this would mean I
> have define 1 frontend
> section, 1 backend section for server01, 1 backend section for server02 and 1
> backend section for
> both, so I can use "default_backend". This would be n+1 backend sections.
>
> Am I getting something wrong? Is this the solution or is there another
> solution?
No you're not wrong. But other solutions really depend on what you want to
achieve.
Regards,
Willy