Forum Discussion

Colin_17201's avatar
Colin_17201
Icon for Nimbostratus rankNimbostratus
Jun 15, 2008

Help On Redirect on F5

Hi All,

 

 

I got a problem is when i enable the "rewrite redirect" on the http profile. After i turn it on with the "matching" not even putting any irules in the Virtual Server, when i type in any url on the web browswer it will automatically turn me to the https page.

 

 

For example : i type http://www.abc.com then it turn me to https://www.abc.com

 

 

I would like to know is this normal ??

 

 

Please HELP.......

5 Replies

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    The rewrite redirect option is triggered without respect to an iRule. This is expected behavior.

     

     

    What are you trying to accomplish with an iRule and/or the rewrite redirects option?

     

     

    Aaron
  • I would like to redirect when access to http://abc.com then redirect it to http://abc.com/abc with the irule below but it keeps on looping. Headache... I am new to iRule.

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] equals "abc.com"}{

     

    HTTP::redirect http://abc.com/abc}

     

    else return

     

    }
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I assume you only want to redirect requests for abc.com to the root document to /abc. If so, you can add a check for the path:

     
     when HTTP_REQUEST { 
        if {[string tolower [HTTP::host]] equals "abc.com" && [HTTP::path] eq "/"}{ 
           HTTP::redirect "http://abc.com/abc" 
        } 
     } 
     

    Aaron
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The reason you were getting a loop is because you were forwarding everything that has a host of abc.com to abc.com/abc.

     

     

    This means abc.com/bob, abc.com/fred, and even abc.com/abc all get redirected to abc.com/abc. That last instance is the loop case.

     

     

    Hoolio's got you covered with his modified rule above.

     

     

    Colin
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Not necessarily.

     

     

    RTFM... The [HTTP::uri] basically returns everything after the host in the URL. [HTTP::path] does the same, EXCEPT that path doesn't include any variables (i.e. everything after the ? is dropped).

     

     

    If there are no variables/parameters specified, then they will be equivalent, otherwise not.

     

     

    H