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

F5_Freek_243545's avatar
F5_Freek_243545
Icon for Nimbostratus rankNimbostratus
Sep 11, 2017

Redirection not working

Hi Friends,

 

I was configuring redirect with three conditions and seems it is not working properly. Can anyone suggest if any changes on this code below?

 

when HTTP_REQUEST {
    set referrer_host [URI::host [HTTP::header value Referer]]
    if { ([string tolower [HTTP::host]] equals "yyy.com") and (([HTTP::uri] equals "/") and ( $referrer_host eq "www.abc.com") ) } {
        HTTP::respond 301 "Location" "https://xxx.com/login"
        return
    }
    if { ([string tolower [HTTP::host]] equals "yyy.com") and (([HTTP::uri] equals "/") and ( $referrer_host ne "www.xxx.com") ) } {
        HTTP::respond 301 "Location" "https://xxx.com/login"
        return
    }   
}

Is there any way we can use switch statements here?

 

No RepliesBe the first to reply