Forum Discussion
simulate special mod_proxy behaviour
Hi Christian,
to translate the
[HTTP::uri] while forwarding the request to your internal server, you could use the rather simple iRule below. The [string range] command will simply strip the first four chars (e.g. /foo) from the original URI and substitute the internal path (e.g. /bar) into a new [HTTP::uri] value.
if { [string tolower [HTTP::uri]] starts_with "/foo" } then {
HTTP::uri "/bar[string range [HTTP::uri] 4 end]"
pool bar_pool
}
But depending on your application requirements, you may also need to translate
[HTTP::header value Referer] values on each request and untranslate [HTTP::header value Location], [HTTP::header value Content-Location], [HTTP::cookie domain], [HTTP::cookie path] and even embeded links in [HTTP::payload] on each response to reflect the external URI namespace.
Note: Personally I always try to avoid hostname and path translation as much as possible. It makes stuff more complex and prone to errors...
I'd like to encourage you to take a look to the existing ProxyPass iRule on CodeShare. It has a really great functionality and provides most of the functionality of the original Apache ProxyPass module.
https://devcentral.f5.com/codeshare/proxypass-v10-v11
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
