This iRule use to default policy for sub.pqr.com request. You should use "*" character for sub-domains.
Also, you can redirect to pool, instead of redirecting to abc.com.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"abc.com" { pool Pool_1 }
"pqr.com" -
"*.pqr.com" {
if { [HTTP::uri] contains "pqr" && [active_members Pool_2] >= 1 } {
pool Pool_2
} else {
pool Pool_1
}
}
"xyz.com" -
"*.xyz.com" {
if { [HTTP::uri] contains "xyz" && [active_members Pool_3] >= 1 } {
pool Pool_3
} else {
pool Pool_1
}
}
default { pool Pool_1 }
}
}