cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

iRule redirect

Ts67p18
Nimbostratus
Nimbostratus

The issue is requests arrive like:

https://www.lor.edu/lorprod/items/ebb81b9e-0e6f-4bd8-af22-bf865212e2cd/1/

and we redirect to:

https://oCCC.edu/ware/lesson/ebb81b9e-0e6f-4bd8-af22-bf865212e2cd/1/

we need to remove the last /1/ if present from each request and the number may not be a "1" and may be a much larger number so that our final redirect looks like:

https://oCCC.edu/ware/lesson/ebb81b9e-0e6f-4bd8-af22-bf865212e2cd

 

our current iRule reads:

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] starts_with "/lorprod/items/" } {

HTTP::redirect "https://occc.edu/courses[string map -nocase {/lorprod/items/ /} [HTTP::uri]]"

}

}

any assistance is greatly appreciated.

2 REPLIES 2

Hi,

when HTTP_REQUEST { if { [string tolower [HTTP::path]] starts_with "/lorprod/items/" } { HTTP::redirect "https://occc.edu/ware/lesson/[getfield [HTTP::path] / 4]" } }

 

Ts67p18
Nimbostratus
Nimbostratus

thank you for the quick response, i will try this immediately.

thanks again

 

bill