Forum Discussion
iRule - Need to skip anything after a specific string in the URI
I already have below iRule, which works good.
when HTTP_REQUEST { if { ![class match [string tolower [HTTP::uri]] contains exception_abc1_to_abc] } { if {([HTTP::uri] starts_with "/wps/portal/home/mycompany/login/!ut") or ([HTTP::uri] starts_with "/wps/portal/home/!ut/") } { HTTP::redirect "; } elseif {([scan [HTTP::uri] {/wps/portal/home/%s} new_uri] == 1) or ([scan [HTTP::uri] {/wps/myportal/home/%s} new_uri] == 1)} { HTTP::redirect http://wwwabc.mydomain.com/${new_uri} } } }
Now I need to add more scenarios as below to the above iRule. Can you please help ?
- If newURI contains “/!ut” , we need to skip everything after “/!ut”
- youssef1
Cumulonimbus
Hi,
you can use this (I tested it and it's working):
if { [HTTP::uri] contains "/!ui" } { regexp {^(.*/!ui).*?} [HTTP::uri] -> newuri HTTP::uri newuri log local0. "AAA - $newuri" }
Regards
- Stanislas_Piro2
Cumulonimbus
you can use this:
if { [set index [string first [HTTP::uri] /!ut]] ne -1 && [string length [HTTP::uri]] > $index } { HTTP::redirect [string range [HTTP::uri] 0 $index]] }
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