Forum Discussion
Scot_85536
Nimbostratus
Dec 02, 2008matchclass using active members
Hi everyone!
This is my current irule:
when HTTP_REQUEST {
sets the timer to return client to host URL
set sectime 10
Use the Host header value for the responses if it's set. If not, use the VIP address.
if {[string length [HTTP::host]]}{
set host [HTTP::host]
} else {
set host [IP::local_addr]
}
Check if the URI is /maintenance
switch [HTTP::uri] {
"/maintenance" {
Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time
HTTP::respond 200 content \
"Maintenance page\
Sorry! This site is down for maintenance.
" "Content-Type" "text/html"
return
}
}
If the pool_testLB is down, redirect to the maintenance page
if { [active_members E1PD ] < 1 } {
HTTP::redirect "http://$host/maintenance"
return
}
}
I'm trying to rewrite it so it uses a data group list for the active_members pool. That way I don't have to have one rule for each pool, I can have a single irule and have it match the value in the data group list. I'm a noob to the F5 platform and irules, so any help or advice appreciated.
- Colin_Walker_12Historic F5 AccountAll you'd need to do is set up a datagroup list that associates some piece of request info (hostname, IP, etc) with the pool that request is going to be sent to. Once you have that the iRule code change is relatively trivial. You'd just perform a findclass to get the pool your request is going to go to, and then substitute that data for the "E1PD" in this example.
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