some curly brackets are missing. The Correct version of the iRule is below.
This iRule always executes LB::detach command, after that, does the second switch command where it hits.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*/aaa/*" {
if { [active_members Pool_aaa] > 0 } {
else {
pool Pool_sorry
}
}
}
"*/bbb/*" {
if { [active_members Pool_bbb] > 0 } {
else {
pool Pool_sorry
}
}
}
}
LB::detach
switch -glob [string tolower [HTTP::uri]] {
"*/ccc/*" {
if { [active_members Pool_ccc] > 0 } {
if { [HTTP::cookie exists "CCC"] } {
persist uie [HTTP::cookie "CCC"]
pool Pool_ccc
}
else {
pool Pool_ccc
}
}
else {
pool Pool_sorry
}
}
default {
if { [active_members Pool_default] > 0 } {
pool Pool_default
}
else {
pool Pool_sorry
}
}
}
}