Forum Discussion
Dave_Horsey_225
Nimbostratus
Jan 25, 2006fail to other pool member based on http status code
We have two servers in a pool behind our LTM. The web servers serve traffic for around 4000 domains on one IP. We would like to have the LTM redirect traffic to the other pool member if either serve...
Jan 25, 2006
Just check the HTTP::status value on the response and issue a HTTP::redirect if it matches your criteria.
This iRule should do the trick.
when HTTP_RESPONSE {
if { [HTTP::status] >= 400 } {
HTTP::redirect "http://www.someotherdomain.com/"
}
}
I would just watch out for 401 (authentication required) status codes. You would likely not want to redirect the user in this case.
Another option exists if all you want to do is present an error message. You can use the HTTP::respond command to send custom HTML back to the user directly from within the iRule. This would eliminate the need for a separate backend server just to service errors. If you have application logic you need to run on the redirect, then this won't really help you.
-Joe
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