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...
Kai_Wilke
Jan 31, 2018MVP
Hi
seems you forgot to close the switch statement right before the added $1 section. Below is the rearanged and already corrected code...
when HTTP_REQUEST {
if { [HTTP::cookie exists cookiecrisp] } {
switch [HTTP::cookie value cookiecrisp] {
"azul" {
if { [LB::status pool POOL-443 member 172.16.1.21 443] eq "up" } {
persist uie 1
pool POOL-443 member 172.16.1.21 443
} elseif { [LB::status pool POOL-443 member 172.16.1.22 443] eq "up" } {
pool POOL-443 member 172.16.1.22 443
} else {
pool POOL-443
}
}
"rojo" {
if { [LB::status pool POOL-443 member 172.16.1.23 443] eq "up" } {
persist uie 3
pool POOL-443 member 172.16.1.23 443
} elseif { [LB::status pool POOL-443 member 172.16.1.21 443] eq "up" } {
pool POOL-443 member 172.16.1.21 443
} else {
pool POOL-443
}
}
"amarillo" {
if { [LB::status pool POOL-443 member 172.16.1.22 443] eq "up" } {
persist uie angel
pool POOL-443 member 172.16.1.22 443
} elseif { [LB::status pool POOL-443 member 172.16.1.23 443] eq "up" } {
pool POOL-443 member 172.16.1.23 443
} else {
pool POOL-443
}
}
}
} else {
pool POOL-443
}
}
Cheers, Kai
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