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

sb_2323_80570's avatar
sb_2323_80570
Icon for Nimbostratus rankNimbostratus
May 10, 2014

HTTPS Response variable

Hi,

I want to set some responses in order that I can set HTTPS via HHTP stream, Could anyone comment if the below syntax is correct for setting HTTPS variables for responses ?

 set xxx_response_body
            {
            http://abc.com====https://abc.com
            http://abc.com:80====https://abc.com
            http&====https&
            }

3 Replies

  • If I understand you correctly you want to redirect the clients connecting on HTTP to HTTPS instead? There is actually a system-supplied iRule that does just that. I don't remember the exact name but when you look at the system supplied iRules it will be fairly obvious which one is the right on. Hope that helps.

     

  • Please try this iRule...

     

    when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] } }

     

  • You're probably better off with a STREAM profile and iRule:

    when HTTP_REQUEST {    
        STREAM::disable        
        HTTP::header remove Accept-Encoding        
    }    
    when HTTP_RESPONSE {    
        if { [HTTP::header Content-Type] contains "text" } {
            STREAM::expression {@http://@https://@}
            STREAM::enable            
        }        
    }    
    

    So instead of maintaining two VIPs (one HTTP and one HTTPS) and redirecting every HTTP request to the HTTPS VIP, a STREAM iRule will simply replace all references to http:// URLs in the response HTML payload.