Forum Discussion

Dassy_165659's avatar
Dassy_165659
Icon for Nimbostratus rankNimbostratus
Oct 11, 2017

Https to https redirection

Hi All,

 

I am having trouble to rewrite an iRule in F5 for HTTPS to HTTPS. Here is my current iRULE(see below) and i want to redirect it as https://xyz.com.au to https://xyz.com .We have certificate installed for *.xyz.com on the F5. Can anyone please help me here

 

Current iRule

 

when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "; } { HTTP::respond 301 Location "; } }

 

1 Reply

  • Hi, the code may work (I removed the semi-colon in if condition)

     

    when HTTP_REQUEST { 
        if { [string tolower [HTTP::host]] equals "www.xyz.com.au" } {     
            HTTP::respond 301 Location "https://www.xyz.com";         
        }     
    }    

    But as ssl is negotiated before the http request is sent by the browser, you will have an ssl error due to ssl mismatch before redirect.

     

    You must have a certificate for to prevent ssl error. You can then configure SNI to send right certificate based on server name extension.