Forum Discussion

N__197982's avatar
N__197982
Icon for Nimbostratus rankNimbostratus
Jul 16, 2018

iRule for redirection with masking for a specific URI only.

Folks,

 

We received some redirect requests for a very particular scenario and based on that I have come up with a iRule which I want to get some additional comments on:

 

The redirect requests are as below:

 

1) If an request is made for https://www.abc.com/manual/* the request needs to forward to https://www.newsite.com/support/txt/docs/. 2) The above redirects must be masked i.e. the end user should not know where is he going to. 3) This applies to URI's which start with "/manual" in the URI. If the keyword "manual" is seen at any other place no action should be taken. 4) The wild character "" indicates this could be any string after "/manual". 5) The redirects would also need to be https. 6) Other than this no other URI needs to be redirected.

 

How should the below iRule look for this request:

 

when HTTP_REQUEST { if { [HTTP:uri] starts_with "/manual/" } HTTP::header replace "Host" "; HTTP::uri "/support/txt/docs/" }

 

Thanks!! N.

 

1 Reply