Forum Discussion
ras2018_335513
Nimbostratus
Dec 17, 2018URI Redirect Coveo Index Test
Looking for assistance with a uri redirect where certain elements of the URI are subject to change,
but the remaining items stay the same.
As an example:
https://api-itg-1.testdomain.com/ab...
Rico
Cirrus
Dec 17, 2018ras,
From my understanding, the iRule you are requesting ignores 'abc' and 'itg' so I have no included any handling for that in my example code. This iRule will only activate if the uri has more than one slash and if it doesnt end with a slash to prevent calculation errors.
when HTTP_REQUEST
{
if {([string trimleft [HTTP::path] "/"] contains "/") and not ([HTTP::path] ends_with "/")}
{
set uri_list [split [HTTP::path] /]
set orig_uri [lindex $uri_list 1]
set uri_elements [split $orig_uri -]
set new_uri [lindex $uri_elements 1]/[lindex $uri_elements 2]
lset uri_list 1 $new_uri
log local0. [join $uri_list /]
HTTP::uri [join $uri_list /]
}
}Hope this helps.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
