I’m wondering whether both a redirect to https and checking about the pool members will work in a single iRule. I’m sure I will be corrected if wrong but I’d add the redirect to the http virtual server (which I presume you’ve got) and then have another iRule for the pool selection on the https virtual server.
when CLIENT_ACCEPTED {
if {[active_members HQ-Pool] < 1}{
Send to the backup pool
pool SC-Pool
}
else {
Send to the default pool
pool HQ-Pool
}
You wouldn’t want to use that redirect code on your production virtual server. It would cause an infinite redirect loop. Instead put it on an empty port 80 virtual with the same IP address.
Here’s another version of code that might also work for you (on the production virtual):
when RULE_INIT {
set static::BACKUP_POOL "local1-pool"
}
when HTTP_REQUEST {
set default_pool [LB::server pool]
log local0. "in event: $default_pool"
if { [active_members $default_pool] < 1 } {
log local0. "no members in default pool"
if { [active_members $static::BACKUP_POOL] < 1 } {
log local0. "no members in backup pool"
HTTP::respond 200 content "No pool members available"
} else {
pool $static::BACKUP_POOL
}
}
}
Remember to remove or comment out the log statements and set the name of the backup pool in RULE_INIT. Because the pool status check is happening in HTTP_REQUEST, you can send the user a message if the backup pool is also down. If you remove the HTTP::respond line you can use this same code in a CLIENT_ACCEPTED event.
Correction, yes, the redirect irule is not in this vip..You all are correct…I only need the use default HQ-Pool, otherwise if down then use backup pool SC-Pool.
why couldn’t you use priority activation - using one pool - just have your production members at a higher priority, if they aren’t available, your traffic will route to the standby member(s)
Definately go with Priority Groups. Another problem with using two groups is that the entire VIP would be taken down if you configure a default Pool for it - regardless of available members of the alternate Pool. If you don’t configure a default Pool the VIP health would always be unknown…