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

Kevhed's avatar
Kevhed
Icon for Nimbostratus rankNimbostratus
Feb 28, 2018

redirect back to client ONLY IF URI contains /apps

I want to create an irule redirect that would only be sent back to the client if the URI contains a "/apps". For example, if user browsers to site1.abc.com...traffic is handled normally by F5 and sent to site1 pool, if user browses to site1.abc.com/assets...traffic is handled normally by F5 and sent to site1 pool. But if user browses to site1.abc.com/apps, then I want the irule to send back redirect to client to go to site2.abc.com/apps.

Below is a simple redirect irule that I got from DevCentral...and I modified it a bit to fit my situation. Would this irule redirect the client's request for "site1.abc.com/apps" to "site2.abc.com/apps" ?

when HTTP_REQUEST {

if { [string tolower [HTTP::host]] equals "site1.abc.com/apps" } {
    HTTP::redirect "http://site2.abc.com/apps"
}

}

1 Reply

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus
    when HTTP_REQUEST {
        switch -glob -- [string tolower [HTTP::path]] {
            "/apps" -
            "/apps/" {
                HTTP::redirect "http://site2.abc.com/apps/"
            }
        }
    }