Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Persistence with Oneconnect

Dexter09_326053
Nimbostratus
Nimbostratus

We've got this irule for cookie persistence and we don't even know what it does. This was a legacy configuration. The issue is that the node still goes to the same server even if that server is down. The healthcheck is ok as we can see from the logs that it was detected as down.

 

We suspect that this rule is somehow causing the issue but we can't even interpret what it does. Any help is much appreciated.

 

2 REPLIES 2

Dexter09_326053
Nimbostratus
Nimbostratus

when CLIENT_ACCEPTED { set default_pool [LB: Server pool] log local5. "Pool $default_pool select" } when HTTP_REQUEST { log local5. "Client Existing Cookie: [HTTP::cookie value "webserver"]" Try to select a pool based on the http cookie containing pool information if { [active_members $default_pool ] > 1 } { if { [HTTP::cookie value "webserver"] equals "server11" } { check if the pool member is active before forwarding if { [lsearch -exact [active_members -list $default_pool] 192.168.1.160] } { node 192.168.1.160 log local5. "Persist to server uws002" } } elseif { [HTTP::cookie value "webserver"] equals "server22" } { if { [lsearch -exact [active_members -list $default_pool] 192.168.1.164] } { node 192.168.1.164 log local5. "Persist to server uws003" } } elseif { [HTTP::cookie value "webserver"] equals "server33" } { if { [lsearch -exact [active_members -list $default_pool] 192.168.1.143] } { node 192.168.1.143 log local5. "Persist to server uws004" } } elseif { [HTTP::cookie value "webserver"] equals "server44" } { if { [lsearch -exact [active_members -list $default_pool] 192.168.1.144] } { node 192.168.1.144 log local5. "Persist to server uws005" } } else { pool $default_pool log local5. "Load Balance to $default_pool pool" } } }

 

Stanislas_Piro2
Cumulonimbus
Cumulonimbus

Hi,

the problem is

[active_members -list $default_pool]
returns a list of list like :

{{192.168.1.144 80} {192.168.1.164 80}}

[lsearch -exact [active_members -list $default_pool] 192.168.1.144]
will always return
-1

the right command must be:

[lsearch -exact [active_members -list $default_pool] {192.168.1.144 80}]

or 

[LB::status pool $default_pool member $target_member 80]

you can try this irule:

when CLIENT_ACCEPTED { 
    set default_pool [LB: Server pool] 
     log local5. "Pool $default_pool select" 
} 

when HTTP_REQUEST {
     log local5. "Client Existing Cookie: [HTTP::cookie value "webserver"]" 
     Try to select a pool based on the http cookie containing pool information 
    if { [active_members $default_pool ] > 1 } { 
        switch [HTTP::cookie value "webserver"] {
            "server11" {set target_member "192.168.1.160"}
            "server22" {set target_member "192.168.1.164"}
            "server33" {set target_member "192.168.1.143"}
            "server44" {set target_member "192.168.1.144"}
            default {
                pool pool $default_pool 
                 log local5. "No cookie : Load Balance to $default_pool pool"
                return
                }
        }
        if { [LB::status pool $default_pool member $target_member 80] } {
            pool $default_pool member $target_member
        } else {
            pool $default_pool 
             log local5. "Pool member failure : Load Balance to $default_pool pool"
        }
    }
}