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
}
Hi Aditya,
You were almost there, you don’t need to set
HTTP::uri
and the final
}
to close the HTTP_REQUEST event was missing. I’ve also remove some necessary parenthesis and the was no advantage in setting
$newUri
other than perhaps readability.
when HTTP_REQUEST {
set var1 "xxx/yyy"
if {[HTTP::uri] contains $var1} {
HTTP::uri [string map -nocase [list $var1 ""] [HTTP::uri]]
pool Pool_1
}
}