Forum Discussion

gamm_31377's avatar
gamm_31377
Icon for Nimbostratus rankNimbostratus
Jan 26, 2015

Find pool member from cookie

Hello, I need to find the selected pool member from a persistence(insert) cookie. I saw this example but it didn't work. The [HTTP::cookie PersistCookie] returns this:69941258.20480.0000 but when I "set pserver [persist lookup uie [[HTTP::cookie PersistCookie]]" the $pserver is null

 

Any idea ?

 

when HTTP_REQUEST { set pserver [persist lookup uie [HTTP::cookie PersistCookie]] if { [LB::status pool http_pool member $pserver 80] eq "up" } { pool http_pool member $pserver 80 } else {

 

2 Replies

  • Hi gamm,

     

    in case you are using cookie insert as persistence method this article from Debbie describes a method to decode it.

     

    Cookie insert works different from universal persistence.

     

    Cookie insert does not create table entries. Instead the returning client provides the information with the cookie. That´s why you will get an empty string after looking up the persistence table.

     

    With universal persistence the virtual server will parse the real servers (pool members) response and create a table entry with a timeout.

     

    The persistence table lookup you are using would return an information about pool, member and port.

     

    So you would need to apply a string split to pick the pool member IP address. Did you name the cookie in the persistence profile as described in your request? Just apply Debbie´s iRule with adjusted cookie name to decode it. Please note that the iRule still has to be modified to work in v11.

     

    Thanks, Stephan

     

  • Any reason you can't just use cookie persistence? Your iRule looks like its trying to do exactly what the normal persistence would do.