Re: cookie that is inserted always expires on browser exit, can i change that?

From: Willy Tarreau <w#1wt.eu>
Date: Fri, 26 Jun 2009 03:32:55 +0200


On Mon, Jun 15, 2009 at 01:40:01PM +0200, Christian Brennsteiner wrote:
> dear group,
>
>
> we are trying to bind a session for a very long time to a specific webserver.
>
> so a client calls the page the first time
> gets a server
> and should remain for as long as possible on this server (even when he
> stops and restarts the browser)
>
> so my question is:
> is it possible to bind a browser for "the lifetime or at least some
> hours" to a specific server (as long as the server is available)?

Right now it's not possible because generally the opposite is expected, and haproxy only emits session cookies, not persistent cookies (which are often blocked by browsers). I don't think it should be too hard to add an "expires" option to the cookie. There is already a "domain". In the mean time, you might be able to perform an awfully dirty trick. If you set a domain to "mydomain.com;\ expires=XXX", it *might* work.

> my config wors very well but the browser switches servers when the
> browser is restarted

what is the main reason for the browser to restart ? Also, if you need to go back to the same server, I suppose you have a context there. Are you sure that the server cookie is persistent ? It sounds very strange to me as most often, application cookies are not persistent across brower restarts either.

> i think the cookie"GUI" is the problem as it expires when the browser restarts.
>
> listen myPoint :9010
> mode http
> server host1.example.com 127.0.0.16:17080 cookie Edi11 check inter
> 30000 rise 4 fall 2
> server host2.example.com 127.0.0.17:17080 cookie Edi22 check inter
> 30000 rise 4 fall 2
> balance roundrobin
> cookie GUI insert indirect
> appsession GUI len 100 timeout 3h
>
> any hints appreciated.
>
>
> sorry if i have some newbie tendencies .. i am playing aroung with ha
> proxy only for a view hours now.

no problem, this is an interesting question anyway :-)

Regards,
Willy Received on 2009/06/26 03:32

This archive was generated by hypermail 2.2.0 : 2009/06/26 03:45 CEST