Forum Discussion

Axel_2807's avatar
Axel_2807
Icon for Nimbostratus rankNimbostratus
Oct 03, 2007

Persit on value of PHPSESSID

Hello,

 

 

I'm a newbie in iRules so sorry if my question is too simple...

 

 

Here is my trouble :

 

- I have two web server with PHP.

 

- I want to have a session persitance by using PHPSESSID which is in my URL

 

- I can't use cookie, because of browser used by my clients (a small bult-in browser in a big application).

 

 

My first idea was to use the value of PHPSESSID :

 

- if it is odd go to server 1

 

- if it is even go to server 2

 

 

(maybe I can also use hash(PSHSESSID)[N] where N is the number of server in my pool) (btw [] means math "modulo")

 

 

But I don't know how to extract the value of PHPSESSID in my URL.

 

Do you think this method could be good?

 

 

If you have any piece of advice about my trouble, ti would help me...

 

 

Thanks a lot.

 

 

Axel

2 Replies

  • If the session ID is in the URL then it should be pretty easy to extract it using iRules.

     

     

    As for using odd vs even, you shouldn't have to worry about that. Let the load balancer just pick a server using its own load balancing algorithms, and then use the session ID to set the persistence.

     

     

    Try setting up a persistence profile using universal persistence and then have an iRule that pulls out the session ID. You'd probably want to have an iRule similar to the ASP session persistence (Click here) but grabbing the session ID from the URL query string. Unfortunately I don't know how you'd get the session ID from the response, and you'd need to do that to make sure you associate the load balancing decision made initially with the session ID.
  • Thanks a lot both of you for your advices. I will try it on my test BigIP1500.

     

     

    I will post here my result.

     

     

    Axel