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:
One of the allowed actions is Replace – HTTP Uri – PATH … with value…
“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).
This doesn’t work as expected
This was the key to get this to work for us! Thanks!