Forum Discussion
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
}
- Kevin_Stewart
Employee
You're going to three separate pools, which could each independently be down. Maybe something like this makes more sense?
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*" { if { [active_membes poolnameA_pool] > 0 } { pool poolnameA_pool } else { HTTP::respond 200 content [ifile get "poolname_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" return } } "*/xyz/*" { if { [active_membes poolnameB_pool] > 0 } { pool poolnameB_pool } else { HTTP::respond 200 content [ifile get "poolname_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" return } } default { if { [active_membes poolnameDefault_pool] > 0 } { pool poolnameDefault_pool } else { 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 }
- Kevin_Stewart
Employee
You definitely use the hash character to make comments.
"/abc.def*" { if { [active_membes poolnameA_pool] > 0 } { sending to pool poolnameA_pool pool poolnameA_pool } else { poolnameA_pool not available HTTP::respond 200 content [ifile get "poolname_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" return } }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com