Need help to understand the iRule

switch -glob [string tolower [HTTP::uri]] {

“/online*” { set is_redirected “legacy” }

}

switch $is_redirected {

“legacy” {

if { [LB::status pool one_digital_ratio_fr_http member 1.1.1.1 80] eq “up” } {

LB::detach

pool one_digital_ratio_fr_http member 10.101.83.80 80

set is_redirected “legacy”

log local0.info “!!! FR DIGITAL REDIRECT - LEGACY”

} else {

log local0.info “Persist server Legacy down! Redirecting”

LB::detach

pool two_digital_ratio_fr_http member 2.2.2.2 80

}

First it checks the URI. If it is starting with “/online*” the variable ‘is_redirected’ is set to “legacy”.

Next, it’s checking if the “is_redirected” variable is set to “legacy”. If it matches “legacy” it will check if pool member 1.1.1.1:80 is up. If it is up, it will make a new load balancing deciscion and set’s the selected pool member to 10.101.83.80. If 1.1.1.1:80 is down, it will make a new load balancing deciscion and set’s the selected pool member to 2.2.2.2:80.