Forum Discussion

Mike_73765's avatar
Mike_73765
Icon for Nimbostratus rankNimbostratus
Aug 20, 2010

issue with cookie persist irule

Hey guys, I am having an issue with an irule that I got from code share that is shown below. This irule is used on 2 virtual servers (using the same nodes, but different ports) and should be persistent between virtual servers. The user logs into the website, which is vs 1, and clicks a link that sends them to vs 2 (the same node). This works only sometimes for the users. The HTTP::response event in this irule always works, but the HTTP::request event gets numerous errors.

 

 

Here’s the error:

 

 

Aug 19 16:18:57 local/tmm err tmm[13657]: 01220001:3: TCL error: cookie - no such pool Failed Tcl_pool_GetFromObj: pool (line 6) invoked from within "active_members -list [LB::server pool]"

 

 

IRule:

 

 

when HTTP_REQUEST {

 

if { [HTTP::cookie exists "cookie"] } {

 

set decrypted [HTTP::cookie decrypt "cookie" "passcode"]

 

if { ($decrypted ne "") }

 

{ set persist_node [HTTP::cookie "cookie"]

 

foreach member [active_members -list [LB::server pool]] { <--Line that fails

 

set node [lindex $member 0]

 

if { $node eq $persist_node }

 

{ node $persist_node [lindex $member 1] } } }

 

log local0. [LB::server] } } <-- Doesn't return anything

 

 

when LB_FAILED { LB::reselect }

 

 

when HTTP_RESPONSE {

 

HTTP::cookie insert name "cookie" value [IP::remote_addr] path /

 

HTTP::cookie encrypt "cookie" "passcode" }

 

 

 

Thanks for your help,

 

Mike

24 Replies

  • Posted By Mike on 08/31/2010 06:27 AM

     

    no, i'm not using OneConnect in any of the virtual servers.

     

     

    Any other ideas to persist across virtuals, pools, and services with this configuration? I also tried a cookie hash profile, but the connection doesn't work at all.

     

     

    Can you turn OneConnect on for a bit? I'm curious to see whether that helps. If that doesn't work, or you're unable to turn it on...We can probably think of some sort of different cookie logic.
  • it looks like the same thing is happening with oneconnect enabled.
  • Added an if statement in case current_pool is null.

    when HTTP_REQUEST {
             If the cookie exists, connect to the IP specified in the cookie
            if { [HTTP::cookie exists "cookie"] } {
                    if { ([HTTP::cookie "cookie"] ne "") } {
                            set persist_node [HTTP::cookie "cookie"]
                           log local0. "persist_node is $persist_node and server pool is [LB::server pool]"
                           set current_pool [LB::server pool]
                          if { $current_pool !=""} {
                            foreach member [active_members -list $current_pool] {
                                    set node [lindex $member 0]
                                    if { $node eq $persist_node } {
                                            node $persist_node [lindex $member 1]
                                    }
                            }
                    }
            }
    }
    }