23-Dec-2010 05:22
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?
23-Dec-2010
09:44
- last edited on
22-Nov-2022
15:51
by
JimmyPackets
The examples you presented are not redirects, because redirects, specifically HTTP redirects is forcing the client's browser to go to a new link or URL. I think what you are refering to is send then the HTTP request to a specific pool based on certain conditions.
So let's start with following pseudo code
IF POOL A is unavailable {
then go to Pool B
ELSE
Go to POOL A
Now there is a command called active_members (http://devcentral.f5.com/wiki/default.aspx/iRules/active_members.html)
When executed this command returns the number of members in a pool So if all the servers in a pool is unavailable then it should return a zero.
Using one of your examples
when HTTP_REQUEST {
if { [active_members pool1] > 0 } {
if { [HTTP::uri] starts_with "/login-test" } {
pool Pool1
}
} else {
pool sorry_page_pool
}
}
I hope this helps
Bhattman
27-Dec-2010
09:50
- last edited on
31-May-2023
15:47
by
JimmyPackets
http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/oneconnect.html
You could also adapt Bhattman's example to cover the edge cases more clearly:
when HTTP_REQUEST {
if { [active_members pool1] == 0 && [HTTP::uri] starts_with "/login-test"} {
pool sorry_page_pool
} else {
pool Pool1
}
}
Aaron