gdoyle
Sep 26, 2018Cirrostratus
Big IP Maintenance Page - Multiple Pool Check.
So a user (Lee) was amazing enough to provide me with a maintenance page irule that also include an http header insert. This resolved my problem completely for one of my VIPs, but I have come to find out that another of the VIPs I need a maintenance page for has no pool member directly tied to it. Instead, it has an iRule that calls on different pools based on the URI. This isn't anything crazy obviously, but I'm not certain how to tie a check for multiple pools into the iRule.
So Lee provided me with the below maintenance page/http header insert rule:
when HTTP_REQUEST {
if {[active_members /partition/poolname_pool] < 1 } {
HTTP::respond 200 content [ifile get "poolname_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
return
}
HTTP::header insert HttpsIndicatorHeader True
}
This works great for the single pool. Below is the iRule for the VIP that calls multiple pools:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/uriX/uriZ" -
"/uriX/uriZ/" -
"/" { HTTP::respond 301 "Location" "https://www.websitename.com/uri/uri/uri" }
"/abc.def*" { pool poolnameA_pool }
"*/xyz/*" { pool poolnameB_pool }
default { pool poolnameDefault_pool }
}
}
Could I do something as simple as this to make this work?
when HTTP_REQUEST {
if { [active_members /partition/poolnameA_pool] < 1 ) } or { [active_members /partition/poolnameB_pool] < 1 ) } or { [active_members /partition/poolnameDefault_pool] < 1 ) } {
HTTP::respond 200 content [ifile get "poolname_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
return
}
HTTP::header insert HttpsIndicatorHeader True
}