Forum Discussion
Erika_I_Garner
Jan 30, 2018Altostratus
IF-elseif-else irule issue
I am trying to add the last else so in case the cookie cookiecrisp then just send the traffic directly to the POOL_443 but it gives me an error. And I was wondering if someone can help me out with th...
Stanislas_Piro2
Jan 31, 2018Cumulonimbus
You can use following code (it assign the pool at the beginning to remove else statements):
when HTTP_REQUEST {
pool POOL-443
set preferedMember [list]
switch [HTTP::cookie value cookiecrisp] {
"azul" {
set preferedMember [list "172.16.1.21" 443 "172.16.1.22" 443]
}
"rojo" {
set preferedMember [list "172.16.1.23" 443 "172.16.1.21" 443]
}
"amarillo" {
set preferedMember [list "172.16.1.22" 443 "172.16.1.23" 443]
}
}
foreach {memberip memberport} $preferedMember {
if { [LB::status pool $default_pool member $memberip $memberport] eq "up" } {
pool POOL-443 member $memberip $memberport
break
}
}
}
I'm not sure the persistence is useful! I guess you can remove it.
The persistence record will match only is cookie value is the same as the previous request and the server is alive. so persistence is only done by cookie value.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects