Forum Discussion
Tharun_91512
Nimbostratus
May 23, 2012HTTP redirection when one server selected
There is a pool with 2 nodes in it. If the client is connecting to the first node then it should be served normally, but if client is connected to the second server then client should be redirected to http://second_node_ip/index.html
Can any one tell me how to write an irule for this. Thanks in advance !!
Regards,
Tharun
3 Replies
- nathe
Cirrocumulus
Tharun
See if this works for you:
when HTTP_REQUEST {
Once pool member has been selected check if it's x.x.x.x
if { [IP::addr [LB::server addr] equals x.x.x.x] } {
HTTP::redirect "http://x.x.x.x/index.html"
}
}
Info from https://devcentral.f5.com/wiki/irules.LB__server.ashx
Rgds
N - Tharun_91512
Nimbostratus
That Didn't worked Nathan. I am getting a connection reset page after putting that iRule.
Regards,
Tharun - nathe
Cirrocumulus
Tharun
Do you need the redirect to go to the actual ip address or can the existing host just be used but adding the URI you mention above?
when HTTP_REQUEST {
Once pool member has been selected check if it's x.x.x.x
if { [IP::addr [LB::server addr] equals x.x.x.x] } {
HTTP::uri "/index.html"
}
}
Rgds
N
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