Forum Discussion
Clint_Denham_16
Nimbostratus
Jul 05, 2007Outage Pool with Redirect to '/'
Hi all - I've found enough info to get a basic rule setup tath does what I want, but now my app team wants to get all fancy on me.
My basic rule is "if the PRODUCTION pool is down, use the outage pool and send all requests to '/'
when HTTP_REQUEST {
if { [active_members prod_pool] == 0 } {
pool prod_outagepool }
if { [active_members prod_pool] == 0 } {
HTTP::uri / }
}
Lame, but effective....
Now the app team doesn't like this / redirect (rightfully so) and they want me to add exceptions to this so that the paths...
/outage
/portal
don't get caught on the "if { [active_members prod_pool] == 0 } {
HTTP::uri / }" redirect above.
Can anyone help me get the syntax right? I've tried this, but it doesn't pass the TCL syntax checker.
when HTTP_REQUEST {
if { [active_members prod_pool] == 0 } {
pool prod_outagepool }
if { ( [active_members prod_pool] == 0 ) and ( [HTTP::uri] begins_with "/outage" ) } {
HTTP::uri /outage }
elseif { [active_members prod_pool] == 0 } {
HTTP::uri / }
}
- There is no "begins_with" operator. Use the "starts_with" operator and you should be set!
when HTTP_REQUEST { if { [active_members prod_pool] == 0 } { pool prod_outagepool } if { ( [active_members prod_pool] == 0 ) and ( [HTTP::uri] starts_with "/outage" ) } { HTTP::uri /outage } elseif { [active_members prod_pool] == 0 } { HTTP::uri / } }
http://devcentral.f5.com/wiki/default.aspx/iRules.Operators
Click here - Clint_Denham_16
Nimbostratus
......whimper....... - Clint_Denham_16
Nimbostratus
Ahh - that's much cleaner. I'm digging into the 'switch' command (I haven't used it before) but the logic is correct. Thanks again!
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