Forum Discussion
Aditya_Mehra
Cirrus
Dec 04, 2018iRule to Remove a part of uri and forward to a pool
Hi,
i am working on an iRule to Remove a part of uri and forward to a pool.
Eg:
xxx/yyy/abc/def should go to a pool 1 as
i want to remove xxx/yyy
Will the below work?
when HTTP_REQUEST {
set var1 "xxx/yyy"
if {([HTTP::uri] contains $var1) } {
set newUri [string map -nocase [list $var1 ""] [HTTP::uri]]
set HTTP::uri ${newUri}
pool Pool_1
}
- Lee_Sutcliffe
Nacreous
Hi Aditya,
You were almost there, you don't need to set
and the finalHTTP::uri
to close the HTTP_REQUEST event was missing. I've also remove some necessary parenthesis and the was no advantage in setting}
other than perhaps readability.$newUri
when HTTP_REQUEST { set var1 "xxx/yyy" if {[HTTP::uri] contains $var1} { HTTP::uri [string map -nocase [list $var1 ""] [HTTP::uri]] pool Pool_1 } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects