Re: Appsession and persistance

From: Baptiste <bedis9#gmail.com>
Date: Thu, 15 Dec 2011 07:08:18 +0100


Hi,

Well, What I would do is something like that:

client ==> ELB ===> HAProxy ===> Servers

HAProxies sharing sticky information in a table and ELB routing traffic to HAProxies (can be 2 to n haproxy instances). HAProxy will get information on how to route the request from it table and will pick up the server from there, wether it was the first LB to route the traffic or not.
Whatever HAProxy used by ELB, the client will always reach the same server.

Note: doing cookie insert or prefix would achieve the same purpose.

cheers

On Wed, Dec 14, 2011 at 8:16 PM, Mir Islam <mislam#mirislam.com> wrote:
> Hi Baptiste your comment about "peer" was interesting. I am wondering if it can be used in conjunction with a SLB in Amazon. Here is what I am thinking.
>
>
> Amazon SLB/ELB is setup in pass thru the send the requests as is to backend HAProxies.
> HAProxyies peer using internal IP or assigned static IP
> If a proxy receives a request for which session is on the other server, it forwards the request back to main IP of the SLB/ELB.
>
> Is that doable? I am going to read up on "peer" option once I am back home. But if the above can be done, lots of headache in making HAprxoy itself HA goes away.
>
> Thanks
> Mir
>
>
> On Dec 14, 2011, at 8:24 AM, Baptiste wrote:
>
>> Hi Erik,
>>
>> Forget about appsession, it's weak :)
>>
>> Use haproxy 1.5-dev7 and stick tables. In your backend, just add the
>> few line below:
>> stick-table type string len 32 size 10K
>> stick store-response set-cookie(PHPSESSID)
>> stick on url_param(session_id)
>>
>> I recommand using with "peer" keyword to get multiple haproxy to sync
>> their tables.
>> So in case of reload of haproxy or in case of lb failure, you could
>> keep on redirecting users to the same backend.
>>
>> cheers
>>
>>
>>
>> On Wed, Dec 14, 2011 at 1:11 PM, Erik Torlen
>> <erik.torlen#apicasystem.com> wrote:
>>> Hi,
>>>
>>> I am working with an application that does not use the cookie as a "normal" application would do.
>>>
>>> Basically it receives PHPSESSID (currently two PHPSESSID is received, which I would try to solve with their devs) and the returns the sessid as a query string on every
>>> call it makes against the web application.
>>>
>>> Example.
>>> Step 1
>>>
>>> GET /login
>>> ...
>>> HTTP/1.1 200 OK
>>> ...
>>> Set-Cookie: PHPSESSID=m2b6m6rkp8l02lu5boflht2pq6; path=/
>>> ...
>>>
>>> Step 2
>>>
>>> GET /list/?session_id= m2b6m6rkp8l02lu5boflht2pq6
>>> ...
>>>
>>> HTTP/1.1 200 OK
>>> ...
>>>
>>>
>>> I tried using appsession for this like:
>>> "appsession session_id len 27 timeout 1h request-learn mode query-string"
>>>
>>> But that does not seem to work.
>>>
>>> I guess I need HAProxy to get the cookie value from the Set-Cookie header and then keeping track of it using the query-string.
>>> Is that possible to do? If so, how is it done?
>>>
>>> /E
>>
>
Received on 2011/12/15 07:08

This archive was generated by hypermail 2.2.0 : 2011/12/15 07:15 CET