Forum Discussion
Peter_Degrassi_
Dec 08, 2006Historic F5 Account
HTTP redirect with monitor
Hi,
I have an IRule that redirects HTTP requests based on the source IP of the request. I'd like to add a check to ensure that the re-direct site is up before redirecting. I'm considering using "LB::status" for this but I'm not sure where to insert it into the rule. Here's my current rule...
when HTTP_REQUEST {
if { [IP::addr [IP::client_addr] equals 10.1.3.0/255.255.255.0] } {
HTTP::redirect "http://10.1.4.11/"
}
}
So I want the redirection to occur only if the client address matches AND the site at 10.1.4.11 is up. Of course I would have to put the server in a pool and assign a monitor.
Any pointers?
Thanks
3 Replies
- hoolio
Cirrostratus
Hello,
If you define the host that you want to redirect to in a pool and assign a monitor to check the state of the host, you could then use LB::status to verify the host is up before issuing the redirect. Check the LB::status page for details/examples (Click here).
The LB::status function was added in 9.2 and late in 9.1.2, I think.
Aaron - Peter_Degrassi_Historic F5 AccountI can't seem to get the syntax correct. How should I construct the iRule? Where do I put the LB::status check so it performs a logical AND with the client IP check? I'm a newb so dumb it down as much as possible. :-)
Thanks - Peter_Degrassi_Historic F5 AccountThanks Aaron, that worked great!
Peter
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
