Forum Discussion
Johan_Van_Geste
Nimbostratus
Apr 12, 2006URL Rewrite/Redirect
Dear All,
we currently have a customer that would like to do the following with iRules: an application-server is listening on http://server/app/ for requests. We'd like to have end-users connecting to http://server and end up on the /app/ page without the end-users having to input this portion.
Is this something that can easily be realised through iRules?
Thanks for your help,
Johan.
2 Replies
- You can use the "HTTP::uri" command to change the uri that is sent to the backend server. It's easy to change the uri, but it's the side cases that you'll want to account for. This iRule will convert "http://server/" into "http://server/app/" but will not do it for "http://server/foo".
when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::uri "/app/" } }
I'm not sure if your application supports GET parameters but that could be an issue as well that you want to take into account. This iRule will add "/app/" to the start of all uri's that don't begin with "/app/".when HTTP_REQUEST { if { ! [HTTP::uri] starts_with "/app" } { set olduri [HTTP::uri] HTTP::uri "/app$olduri" } }
That may be more what you are looking for. You'll have to play around with the logic to determine all your corner cases.
-Joe - Johan_Van_Geste
Nimbostratus
Thanks Joe, these things did the trick in an easy way ...
Kind regards,
Johan.
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