Forum Discussion
Keith_Goguen_52
Apr 06, 2011Nimbostratus
Simple iRule for URL appending?
Hey - was wondering if someone could give me a hand with a pretty basic task... how to append(or redirect) and URL. I have some people comming into a VS for "host.unit.com", but I have to send them to...
Kevin_Stewart
Apr 24, 2013Employee
There are a few considerations to your request:
1. If you JUST want to hide the /test URI from the client, you can use the HTTP::uri command to transparently change the URI in the HTTP request.
when HTTP_REQUEST {
HTTP::uri "/test[HTTP::uri]"
}
This is a rather brute force way of changing the incoming URI to "/test" plus whatever is already in the client's request.
Ex. client requests "/foo" and the server sees "/test/foo"
2. The problem with the above approach is that it doesn't account for what information the server may send back to the client in the form of object references. If that is a concern, then there are a few options, but I'd recommend an iRule-based stream expression to replace "/test" references in the response payload. The wiki page for streams has some pretty good examples that modify content in the HTTP_RESPONSE event.
3. The problem with the above is that it doesn't account for complex applications. Your example only shows one URI, but if that's just for illustration purposes and your environment is much more complicated than that, then I'd recommend a ProxyPass solution. The ProxyPass iRule will do exactly what you require but can handle much more complex requirements. If that's an option, do a quick search on this site for "ProxyPass".
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