Forum Discussion
Francois_Begin_
Nimbostratus
Jul 06, 2005Redirect questions
Hi all,
I am trying to create a re-direct that will achieve this:
Take a request for http://banana.fruits.com/Data and re-direct it to http://:1601/
At this time, we re-direct to a single server, but we will be re-directing to a pool of servers in the future.
The request comes in on port 80 and goes to port 1601 on the back end server.
The '/Data' of the initial request needs to be stripped. The html documents being accessed are located at the root of the back end server.
So far, I made it work with this simple irule:
when HTTP_REQUEST {
if { [HTTP::uri] contains "ASFData" } {
HTTP::redirect http://142.178.100.139:1601
}
}
This works but there are a few problems:
Firstly, this works only for a single host. How would I re-direct to multiple hosts? And how would I ensure availability if one of the hosts was to go down?
Secondly, when a user type in http://banana.fruits.com/Data in his/her browser, this gets changed to http://:1601. Can I do this re-direct transparently for the user i.e. he/she would still see http://banana.fruits.com/Data in his/her browser but get re-directed to the back end server.
Thanks,
François Bégin
- drteeth_127330Historic F5 AccountDo you need to use a redirect? Why not select a different pool instead?
- François_Bégin_
Nimbostratus
I tried selecting a pool but that did not work as I need to deal with '/Data'. Selecting a pool means the request goes from - drteeth_127330Historic F5 AccountYes, you can rewrite the request. If there are no path components following data, then something like this should work:
HTTP::request "/"
- François_Bégin_
Nimbostratus
Ok, here is the irule I am trying to enter: - drteeth_127330Historic F5 AccountOops. I meant HTTP::uri. Sorry.
- François_Bégin_
Nimbostratus
Still no success. Here is my rule - drteeth_127330Historic F5 AccountDid you add the log directives in the iRule or on the back-end webserver? I have tested the rule on my big-ip and it appears to work as intended. What version of big-ip are you running? I seem to recall a bug with the contains operator, but it was fixed long ago.
- François_Bégin_
Nimbostratus
Log directives were on the F5 - François_Bégin_
Nimbostratus
This appears to be working now. I was missing a default SNAT, and a default pool for the irule.
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