Forum Discussion
SysAdmins_23367
Nimbostratus
Apr 09, 2010can't get HTTP::redirect to work
I'm attempting to make a simple iRule which will redirect a user with a defined IP address and allow everyone else who connects to the default pool. The problem is that everytime I associate the following iRule to my virtual server I get a "page cannot be displayed" error. Even if I'm connecting from an IP which is not 192.168.98.232 I still get the page cannot be displayed error. I am able to access http://192.168.30.53/index.html directly from my PC and the F5 so it's not a firewall issue. Any help would be greatly appreciated.
when HTTP_REQUEST {
if { [[IP::client_addr] equals 192.168.98.232]}
{ HTTP::redirect http://192.168.30.53/index.html }
else { forward }
}
1 Reply
- hoolio
Cirrostratus
If you check the /var/log/ltm log file, you should see runtime TCL errors indicating an invalid command of 1 or 0. If you add the IP::addr command it should work fine:when HTTP_REQUEST { if { [IP::addr [IP::client_addr] equals 192.168.98.232]}{ HTTP::redirect "http://192.168.30.53/index.html" } }
Note that the forward command will cause LTM to forward the request without load balancing to the VIP's default pool. The destination address won't be translated. So you can remove the else clause and then LTM will use the VIP's default pool for any non-matching IP.
Aaron
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