Forum Discussion
spark_86682
Oct 30, 2009Historic F5 Account
If your iRule really is that simple, then I have two suggestions. First, you could use variables:
switch [string tolower [HTTP::host]] {
"www.host.com" {
set uppool www.host.com_80
set dnpool downtime_pool_80
}
"www.host2.com" {
set uppool www.host2.com_80
set dnpool downtime_pool_80
}
"www.host2.com" {
set uppool www.host3.com_80
set dnpool downtime2_pool_80
}
}
if { [active_members $uppool] > 0 } {
use pool $uppool
} else if { [active_members $dnpool] > 0 } {
use pool $dnpool
} else {
Server up LB-hosted maintenance page
}
The second suggestion would be to replace the switch statement with datagroups. This would help if you start getting large numbers of sites and want to keep your logic separate from your configuration.