Forum Discussion
URI Trimming
Hello,
I am making an irule where if the irule contains certain character in this case lets say AA, it should remove AA and modify the uri as it is .so, lets say if the url is https://abc.com/AA/xyz, then it should modify it to https://abc.com/xyz and then take it to pool_AA.
I have made this irule but it doesnt seem to be working:
Please advise:
when HTTP_REQUEST { if { [[HTTP::uri]] starts_with "/AA/"} { HTTP::uri [string trimleft [HTTP::uri] /AA]
pool pool_AA
}
if { [[HTTP::uri]] starts_with "/BB/"}
{
HTTP::uri [string trimleft [HTTP::uri] /BB]
pool pool_BB
}
}
- Stanislas_Piro2Cumulonimbus
According to this page, the string "/AA" means it remove every characters until the character is not / or A or A
so the URI /AA/xyz will become xyz (without the first /)
- youssef1Cumulonimbus
Hi,
you can use string range:
when HTTP_REQUEST { set uri [HTTP::uri] if { $uri starts_with "/BB" } { set uri [HTTP::uri] HTTP::uri [string range $uri 3 end] } }
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