Forum Discussion
Aditya_Mehra
Cirrus
Nov 20, 2018Need to modify the uri via irule
Hi,
Need help for an iRule
condition:When url has both characters .xxx and / , then redirected url should not have / .
incoming url : https://a.b.c.com/aaa// abc/def/geh.xxx?Org=123
redirected url : https://b.a.c.com/aaa/abc/def/geh.xxx?Org=123
also normal url without / should redirect normally a.b.c to b.a.c
incoming url : https://a.b.c.com/
redirected url : https://b.a.c.com/
- Lee_Sutcliffe
Nacreous
Hi Aditya,
If using a traffic policy as Philip has suggested, is not an option, you could use the following iRule:
when HTTP_REQUEST { set var1 "xxx" set var2 "/" set newHost "b.a.c.com" if {([HTTP::uri] contains $var1) && ([HTTP::uri] contains $var2)} { set newUri [string map -nocase [list $var2 ""] [HTTP::uri]] HTTP::redirect https://${newHost}${newUri} } elseif {!([HTTP::uri] contains "/")} { HTTP::redirect https://$newHost[HTTP::uri] } }
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