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

Diego_23471's avatar
Diego_23471
Icon for Nimbostratus rankNimbostratus
Mar 10, 2014

uri rewrite or redirect

Hello

 

I would like to setup an irule to enforce the url used to access a site.

 

For example, for site http://lab.test.com/login.

 

If someone tries to alter the url to http://www.lab.test.com/login, they should be redirected to http://lab.test.com/login.

 

This should be true for any uri that includes www.lab.test.com

 

4 Replies

  • So the URI should ALWAYS be /login? If so, then:

    when HTTP_REQUEST {
        HTTP::uri "/login"
    }
    

    This would forcibly replace any incoming URI with "/login".

  • no. It could be anything. I am trying to remove www.

     

    If I type www.lab.test.com/login. I should be redirected to lab.test.com/login

     

    If I type www.lab.test.com/zxw2389s . I should be redirected to lab.test.com/zxw2389s

     

  • Ah, so:

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] ne "lab.test.com" } {
            HTTP::redirect "http://lab.test.com[HTTP::uri]"
        }
    }