Forum Discussion

Patrick_Berthia's avatar
Patrick_Berthia
Icon for Nimbostratus rankNimbostratus
Feb 10, 2006

HTTPS redirect

Hi,

 

 

Im trying to make this work but not getting the expected results.

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "/" } {

 

HTTP::redirect https://[HTTP::host][HTTP::uri "/some_java_app"]

 

}

 

}

 

 

I just want to force the users that are using the http://mysite.domain.com to redirect them to https://mysite.domain.com/some_java_app

 

 

Any tips would be greatly appreciated

3 Replies

  • What results are you getting? Odds are the HTTP::uri command you have embedded is not returning the updated value that you are assigning it within the command. This would cause an infinite loop if you have the same iRule on the 80 and 443 virtuals.

    Personally, I'd do something like this:

    
    when HTTP_REQUEST {
      if { [HTTP::uri] equals "/" } {
        HTTP::redirect "https://[HTTP::host]/some_java_app"
      }
    }

    You don't need to reassign the HTTP::uri value if you are doing a redirect.

    -Joe

  • Hi,

     

     

    Tried using the rule you supplied, this is what happens:

     

     

    I hit https://mysite.domain.com/ and am redirected to https://mysite.domain.com/some_java_app although when using http://mysite.domain.com/ I'm not getting redirected to https://mysite.domain.com/some_java_app as expected.

     

     

    Any clue on what im doing wrong?
  • How are your virtual servers configured? Are you using a wildcard virtual server (10.10.10.10:0) or virtual servers for each service (10.10.10.10:80 and 10.10.10.10:443)?