Forum Discussion
Cliff_Airhart_1
Nimbostratus
Apr 07, 2005Redirecting HTTP to a website using iRule
I am trying to setup an iRule that will provide the following:
When a user types the following URL ( http://www.company.com ) it will be redirected automaticall to
http:...
bknotwell_12713
Apr 07, 2005Historic F5 Account
Sorry about the confusion, the initial command was the output of a rule show.
b rule myredir '{if(http_host == "x.xx.xxx") { redirect to "http://x.xx.xxx:80/index.shtml" }'
b virtual 192.168.1.22:0 { use rule myredir }
From a box on the .1 network:
bash-2.05b$ telnet 192.168.1.22 6666 it could be any port
Trying 192.168.1.22...
Connected to 192.168.1.22.
Escape character is '^]'.
GET / HTTP/1.0
Host: x.xx.xxx
HTTP/1.0 302 Found
Location: http://x.xx.xxx:80/index.shtml
Connection: close
Connection closed by foreign host.
bash-2.05b$
Finally, it's important to understand that a 4.X rule allows a limited number of branches so if you intend to do a lot of comparisons, you'll want to do something different. I don't have anything specific, but I'd guess a rule and class combination* will give you what you want.
*ask.f5.com probably has a good example of mapclass2node usage. I suspect the solutions guide does as well.
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
