Forum Discussion
Andrew_Smith_16
Jun 15, 2016Nimbostratus
iRule with pool status and maintenance page
I have several iRules that currently have 20+ switch elements that matches on a specific uri which takes you to a particular pool. I now need to display a maintenance page if there are no members in ...
- Jun 15, 2016
Hi,
Here is an irule example that do the same as your own irule :
when HTTP_REQUEST { if { [active_members pool1] <1 or [active_members pool2] <1 or [active_members pool3] <1} { if { [URI::basename [HTTP::uri]] eq "logo.jpg" } { HTTP::respond 200 content [ifile get logo.gif] "Content-Type" "image/gif" } else { HTTP::respond 200 content [ifile get error.html] "Content-Type" "text/html" } } else { switch -glob [HTTP::uri] { "/foo1*" { pool pool1 } "/foo2*" { pool pool2 } "/foo3*" { pool pool3 } } } }
Yann_Desmarest
Jun 15, 2016Cirrus
Hi,
Here is an irule example that do the same as your own irule :
when HTTP_REQUEST {
if { [active_members pool1] <1 or [active_members pool2] <1 or [active_members pool3] <1} {
if { [URI::basename [HTTP::uri]] eq "logo.jpg" } {
HTTP::respond 200 content [ifile get logo.gif] "Content-Type" "image/gif"
} else {
HTTP::respond 200 content [ifile get error.html] "Content-Type" "text/html"
}
} else {
switch -glob [HTTP::uri] {
"/foo1*" { pool pool1 }
"/foo2*" { pool pool2 }
"/foo3*" { pool pool3 }
}
}
}
- Andrew_Smith_16Jun 15, 2016NimbostratusThanks very much. I made a mistake in my example as well but this looks a lot cleaner.
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