Question about Cookie-Configuration

From: Mirco Heibült <mirco#nitestar.de>
Date: Thu, 31 Jan 2008 21:47:13 +0100


Hello there,  

I have some problems with understanding the cookie sessions. I tried two things on my working haproxy.  

First:

cookie SERVERID rewrite

#option httpclose  

Problem: Often I am redirected to another server although I was logged in my Community the SERVERID-Server, so the user was logged out! :-(  

Second:  

cookie SERVERID insert

option httpclose  

Every PHP-Code had this at the beginning:  

// save used server

if(!isset($_COOKIE['SERVERID']))

{

            setcookie('SERVERID',
$connections[$_SERVER['SERVER_ADDR']]['server_id']);

            $_COOKIE['SERVERID'] =
$connections[$_SERVER['SERVER_ADDR']]['server_id'];

}  

The second seemed better…but in the rush hour, the Server got totally slow, very unperformant. And sometimes there came no answer.

So I had to stop the second test and went back to the first configuration.  

Mmm…now I added the following at the beginng of any exectuted PHP-File, after the if-clause above:  

elseif($_COOKIE['SERVERID'] !=
$connections[$_SERVER['SERVER_ADDR']]['server_id'])

{

            setcookie('SERVERID',
$connections[$_SERVER['SERVER_ADDR']]['server_id']);

            header('Location:
http://www.nitestar.de'.$_SERVER['REQUEST_URI']);

}  

This seemed to be a bad workaround. But how can I do the same best with haproxy? Of course I read the manual but I think I didn’t understand this perfect.    

Thanks for Help!  

Mirco Received on 2008/01/31 21:47

This archive was generated by hypermail 2.2.0 : 2008/01/31 22:00 CET