Forum Discussion
Jamesy_105825
Dec 23, 2010Nimbostratus
redirect and sorry server, new to irules
I am trying to write an iRule to redirect to a sorry server where another redirect rule exists. I'm new to irules and I can't seem to wrap my head around the logical flow.
Essentially, I want it to perform the initial redirect, but then redirect to a sorry pool if none are available in that pool. Can I do a nested if statement inside the first one?
Here are some examples of the current redirects (these are both separate iRules):
-=-=-=-=-=-=-=-=-=-=-=-
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/login-test" } {
pool Pool1
}
}
-=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-
when HTTP_REQUEST {
if { ( [HTTP::host] contains "hostname.domain1" ) or ( [HTTP::host] contains "hostname.domain2" ) } {
pool Pool2
}
}
-=-=-=-=-=-=-=-=-=-=-=-
Can someone help me understand what I need to do?
- The_BhattmanNimbostratusHi Jamesy,
when HTTP_REQUEST { if { [active_members pool1] > 0 } { if { [HTTP::uri] starts_with "/login-test" } { pool Pool1 } } else { pool sorry_page_pool } }
- hooleylistCirrostratusIf you're switching pools or pool members based on URI, make sure to add a OneConnect profile to the virtual server. If you're using SNAT set the OneConnect source mask to 0.0.0.0. If you're not using SNAT, set the source mask to 255.255.255.255. For more info check this wiki page:
when HTTP_REQUEST { if { [active_members pool1] == 0 && [HTTP::uri] starts_with "/login-test"} { pool sorry_page_pool } else { pool Pool1 } }
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