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

Phil_Nikray_728's avatar
Phil_Nikray_728
Icon for Nimbostratus rankNimbostratus
Sep 19, 2014

iRule redirect question

Hi all,

 

Could someone help me with configuring an iRule that redirects http://www.abc.com to https://www.abc.com:81

 

I have an example of an HTTP to HTTPS redirection but I'm not sure how to redirect to a different destination port.

 

Thanks

 

1 Reply

  • a basic rule that can be applied to a port 80 virtual server that redirects all traffic from port 80 to port 81 would be

    when HTTP_REQUEST {
        HTTP::redirect https://[getfield [HTTP::host] ":" 1]:81[HTTP::uri]
    }
    

    Basically the built in redirect rule with :81 squeezed between the host and the URI where it belongs.

    Result:

    Escape character is '^]'.
    GET /path?query HTTP/1.1
    Host: www.abc.com
    Connection: Close
    
    HTTP/1.0 302 Found
    Location: https://www.abc.com:81/path?query
    Server: BigIP
    Connection: close
    Content-Length: 0