For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Hajar's avatar
Hajar
Icon for Nimbostratus rankNimbostratus
Feb 19, 2016

Redirect subfolders

Hello, How can I write an iRule to do a redirect from F5 to our cloud site(no pool in F5). I need to make sure to redirect top level and also any other folders to exact folder name on cloud.

for example

Top-level redirect

      http://my.x.com => https://cloud.y.com/y/y.do

Article redirect, for any article ID "XXXX"

      http://my.x.com/XXXX => https://cloud.y.com/y/y.do?id=XXXX

1 Reply

  • Hi Hajar,

    you may use this snippet as a starting point...

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] equals "my.x.com" } then {
            if { [HTTP::uri] equals "/" } then {
                HTTP::redirect "https://cloud.y.com/y/y.do"
            } else {
                HTTP::redirect "https://cloud.y.com/y/y.do?id=[URI::encode [string range [HTTP::uri] 1 end]]"
            }   
        }
    }
    

    Cheers, Kai