Forum Discussion
hooleylist
Jan 14, 2009Cirrostratus
Hi Dan,
If you don't want the client to see the updated URI, you could create a sorry pool and use that pool in LB_FAILED.
Here is an untested example based on this post:
http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=2922629646
when CLIENT_ACCEPTED {
Initialise a variable to track whether the load balancing attempt has failed
set retries 0
}
when HTTP_REQUEST {
Check if there has been a load balancing failure
if { $retries > 0 } {
Rewrite the URI if it hasn't already been rewritten
if {not ([HTTP::path] contains "sorry")}{
Rewrite the URI for the sorry page
HTTP::uri "/sorry/sorry.html"
}
} else {
This isn't a retry, so save the request headers and data
set request [HTTP::request]
}
}
when LB_SELECTED {
Check if there has been a load balancing failure
if { $retries >= 1 } {
Select a new pool member from the sorry pool
LB::reselect pool sorry_pool
}
}
when LB_FAILED {
Track that the load balancing attempt failed
incr retries
Retry the HTTP request
HTTP::retry $request
}
when HTTP_RESPONSE {
There was a successful response, so we could reset retries to 0?
set retries 0
}
If the sorry.html page references images or other content, you might need to add logic to HTTP_REQUEST to specify the sorry pool for any request which has "sorry" in the path.
If this doesn't work for you, can you add logging to the iRule and post the log output from /var/log/ltm?
Thanks,
Aaron