Forum Discussion

Jeff_Morrison_4's avatar
Jeff_Morrison_4
Icon for Nimbostratus rankNimbostratus
Dec 14, 2005

Using 80 port for redirection

I have created several Virtual Servers using the same IP and different ports.(80, 4443) When I use the below iRule and set the port redirection to port 4443 all works correctly, however if I use port 80, the rule fails to inject the new port 80 into the URL, but it will inject port 4443 into the URL.

 

 

The reason I want to use port 80, is because it is a well known port and won't get blocked by firewalls.

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] contains "/CMFCU"} {

 

pool Prod_7001

 

} elseif { [HTTP::uri] contains "/Customer1"

 

or [HTTP::uri] contains "/Customer2

 

or [HTTP::uri] contains "/Customer3" }{

 

HTTP::redirect https://[HTTP::host]:80[HTTP::uri]

 

} else {discard}

 

}
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Could this be a client browser problem. Everything your doing looks ok.
  • The standard port for https is 443, and most corporate firewalls allow it to pass.

     

     

    
    when HTTP_REQUEST {
      if { [HTTP::uri] contains "/CMFCU"} { 
        pool Prod_7001
      } elseif { [HTTP::uri] contains "/Customer1" 
              or [HTTP::uri] contains "/Customer2 
              or [HTTP::uri] contains "/Customer3" }{
        HTTP::redirect https://[HTTP::host][HTTP::uri]
      } else {discard}
    }

     

     

     

    I use similar code in-house, and my virtual server looks like:

     

     

    
    virtual webmail-redirect {
       destination 1.2.3.4:http
       snat automap
       ip protocol tcp
       profile http tcp
       rule webmail-redirect
    }

     

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Another thing I'll add is that you can normally send https traffic to a server listening on port 80. The server will need to be configured for encrypted traffic on port 80 (usually https traffic goes to port 443). Otherwise, the server will try to treat the data as an HTTP request - and it will undoubtably not look like any request your server has ever seen before...