Forum Discussion
Pierrejn
Nimbostratus
Feb 06, 2017iRule Help Please
I'm trying to combine L7 Load Balancing with sending a maintenance page if the pool/pools are down. Please see below.
Code when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] equals _http_pools] } {
pool [class match -value [string tolower [HTTP::host]] equals _http_pools]
}
}and trying to combine the following
Code when HTTP_REQUEST {
set VSPool [LB::server pool]
if { [active_members $VSPool] < 1 } {
log local0. "Client [IP::client_addr] requested [HTTP::uri] no active nodes available..."
HTTP::respond 200 content "
We'll be back!
IMPORTANT MESSAGE
Please be advised that we are performing a scheduled maintenance on the site you are trying to access. All site access will be unavailable during this maintenance. Service is expected to resume February 4 at 5 a.m. CT
"
}
}1 Reply
Hi Pierrejn,
the iRule below is a combination of your two dedicated iRules...
when HTTP_REQUEST { set VSPool [class match -value [string tolower [HTTP::host]] equals _http_pools] if { $VSPool ne "" } then { if { [active_members $VSPool] > 0 } then { pool $VSPool } else { log local0. "Client [IP::client_addr] requested [HTTP::uri] no active nodes available..." HTTP::respond 200 content " We'll be back! IMPORTANT MESSAGE Please be advised that we are performing a scheduled maintenance on the site you are trying to access. All site access will be unavailable during this maintenance. Service is expected to resume February 4 at 5 a.m. CT " } } else { Unknown HOST-Name requested... } }Note: Updated the post to correct a formating glitch...
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects