Re: Maintaining session persistance

From: Willy Tarreau <w#1wt.eu>
Date: Thu, 30 Jul 2009 06:24:52 +0200


Hi,

On Tue, Jul 28, 2009 at 10:54:17AM -0400, Chuck Koscher wrote:
> Hi,
>
> This question is more for my own understanding. I'm trying to have
> sessions sent to the proper backend server which serviced the original
> request. From my reading of the HAproxy config docs I thought
> 'appsession' would do the trick. However when I try the first config
> block shown below HAproxy does not observe the JSESSIONID cookie, it
> just keeps chugging along using round-robin.
>
> The second config block does work.
>
> What am I missing?

I think that it's simply because your timeout is too short, so haproxy learns a session cookie and destroys it 5 seconds later, so your persistence does not work if you do your clicks more than 5s apart.

You may also be interested in using the "prefix" mode if you want only one cookie.

Regards,
Willy

> ==== does not work
>
> backend admin
>
> option httpchk GET /servlet/useragent?func=showHome
> option httpclose
> balance roundrobin
> appsession JSESSIONID len 52 timeout 5000
> server cr10 172.20.1.17:80 maxconn 50 check
> server cr5 172.20.1.29:80 maxconn 50 check
>
> ==== does work
>
> backend admin
>
> option httpchk GET /servlet/useragent?func=showHome
> option httpclose
> balance roundrobin
> cookie crsvr insert nocache
> server cr10 172.20.1.17:80 cookie cr10 maxconn 50 check
> server cr5 172.20.1.29:80 cookie cr5 maxconn 50 check
Received on 2009/07/30 06:24

This archive was generated by hypermail 2.2.0 : 2009/07/30 06:30 CEST