F5 BIG-IP icon   F5 BIGIP – Modify URI path using local traffic policy



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.

It could be done using an IRule:

when HTTP_REQUEST{
if { [string tolower [HTTP::uri] ] starts_with "/path1" } {
  HTTP::uri [string map {"/path1/" "/"} [HTTP::uri]]
  node 10.10.10.20 8000
}
}

Given that im using policies to publish these websites, I tried to strip the string from the path using a policy action that allows to modify the path. Finally achieved this way:
F5 BIGIP - Modify URI path using local traffic policy 1

One of the allowed actions is Replace – HTTP Uri – PATH … with value…
F5 BIGIP - Modify URI path using local traffic policy 2

“value” can be a tcl expression like the one used in the IRule, but using this format:

tcl:[string map {"/path1/" "/"} [HTTP::uri]]

This way there is no need of an IRule (that would be processed after the policy).

Leave a Reply

Your email address will not be published. Required fields are marked *