Forum Discussion

Randy_Mays_7798's avatar
Randy_Mays_7798
Icon for Nimbostratus rankNimbostratus
May 14, 2010

HTTPS Redirect for a specific URL, URI

I have an iRule that I have written that I think will do what I need it to do but would like someone to confirm this, or tell me what's wrong. (Joe is just an example)

 

 

when HTTP_REQUEST {

 

if {([HTTP::host] equals "www.joe.com" and

 

([HTTP::uri] equals "/net/myjoe")}

 

{ HTTP::uri "https://www.joe.com/net/myjoe"

 

}

 

}

 

 

When a client request "http://www.joe.com/net/myjoe" I need them to be redirected to "https://www.joe.com/net/myjoe".

 

But if they request any other uri at www.joe.com using http I need that traffic to be passed to the pool.

 

 

Will the above iRule work?

12 Replies

  • This setting worked well for both pages. Thank you guys for assisting.

     

    HTTP VIP: when HTTP_REQUEST { if { ( [string tolower [HTTP::uri]] starts_with "/contact-us" ) or ( [string tolower [HTTP::uri]] starts_with "/feedback" ) } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }

     

    HTTPS VIP: when HTTP_REQUEST { if { not ( [string tolower [HTTP::uri]] starts_with "/contact-us" ) and not ( [string tolower [HTTP::uri]] starts_with "/feedback" ) } { HTTP::redirect "http://[HTTP::host][HTTP::uri]" } }