Hi all
Im using my F5 BIGIP (v13) as reverse proxy to publish some websites by using local traffic policies.
But i need to perform a URL rewriting. To be specific, i need to strip a string from the URI path.
When applied as IRule it works correctly as I want:
when HTTP_REQUEST { if { [string tolower [HTTP::uri] ] starts_with “/path1” } { HTTP::uri [string map {“/path1/” “/”} [HTTP::uri]] node 10.10.10.20 8000 } }
But when using local traffic policy it does not work as expected:
Replace - HTTP Uri - PATH … with value… tcl:HTTP::uri [string map {“/path1/” “/”} [HTTP::uri]]
Am i doing something wrong? What would be the correct way?
Thanks all!
Hi
you don’t have to put the HTTP::uri in tcl command:
Replace - HTTP Uri - full ... with value... tcl:[string map {"/path1/" "/"} [HTTP::uri]]
Hola Javier, How are you publishing the URLs? is it using a single VS for all the URLs or a different IP Address on each URL? as we want to do something similar
Thanks
Hi!
Yes, i have published multiple sites in a single VS. Check this I post i have just published in which it is explained:
F5 BIGIP – Name based reverse proxy (LTM policies)
Hope it helps!
Hola Javier, I follow your guide and that was very handy, a quick query about it:
- On the VS, we don’t need to associate it a Default Pool, do we? as my thoughts are that, once a connection hits the VS, the policy associated to that VS will select to which pool or node that to be sent internally [as Reverse Proxy based on URI]
Let me know please
Thanks
Hi Atif! Correct. The “default pool” is left set to “None”. The logic to select node/pool/VS will be applied by using a policy that is assigned as shown in the post.
Javier, if we want to Load balance the request coming to the reverse proxy, is that what I need to do: on the Policy rule applied to the VS, when the traffic is matched, send it to a pool [where the members of the pool will be nodes with different IP addresses to be load balanced on each request].
Let me know please