Forum Discussion

Irineu_Costato_'s avatar
Irineu_Costato_
Historic F5 Account
Aug 02, 2010

Cookie Persistence

Hi Folks,

I need to create an irule using cookie persistence, I create this below, is it work ? I don´t have how to try now.

when HTTP_REQUEST {
    if {[HTTP::cookie ]} {
    use pool PoolA 
    }
    if {[HTTP::cookie ]} {
    use pool PoolB 
    }
    else { use pool PoolC }
}

I would like that the client that already has a cookie called PoolA go to pool PoolA, the same for PoolB and new clients goes to PoolC.

Thanks

6 Replies

  • You need to specify the name of the cookie...something like this:

     when HTTP_REQUEST { 
     if { HTTP::cookie exists "PoolA" } { 
     pool PoolA } 
     }
    
  • How would someone get a cookie for poolA or poolB if they never get load balanced there? Wouldn't you want some logic that selects the poolA or poolB for new clients as well?

     

     

    Aaron
  • Irineu_Costato_'s avatar
    Irineu_Costato_
    Historic F5 Account
    Aaron,

     

     

    The clients that already get this load balance before has a cookie, cookie PoolA or cookie PoolB, the new clients, with no cookie, go to the other pool (PoolC). Is that right ?
  • If the clients are all going through this iRule, they'd never get load balanced to pool A or B though. They'd only ever get to pool C, unless the members of pool C set a cookie for pool A and/or B.

     

     

    Aaron
  • Posted By hoolio on 08/10/2010 03:44 AM

     

    If the clients are all going through this iRule, they'd never get load balanced to pool A or B though. They'd only ever get to pool C, unless the members of pool C set a cookie for pool A and/or B.

     

     

    Aaron

     

     

    I imagine that's the case...but we'll have to wait for his reply. I have a similar model where Pool C would contain all the servers in Pools A and B...if the chosen server was in Pool A, I'd want them to come directly to Pool A next time, etc.