Forum Discussion

Shawn_Roman_262's avatar
Shawn_Roman_262
Icon for Nimbostratus rankNimbostratus
May 11, 2016

Can Someone tell me the best way to create an HTTP to HTTPS redirection.

I am looking to create a VIP using redirection and would like to know what the best way to accomplish this is?

 

Here is the basic idea that I am looking to accomplish: http://123.abc.com:9080 ---> https://123.abc.com:9443

 

Thanks in advance.

 

12 Replies

  • Hello,

     

    You can create a Virtual Server that listen on the same IP but on port 80. You then assign an http profile and a specific irule available by default (_irule_redirect_http_https)

     

  • Hello,

     

    You can create a Virtual Server that listen on the same IP but on port 80. You then assign an http profile and a specific irule available by default (_irule_redirect_http_https)

     

  • Create two virtuals with the same IP but with different ports. 80 and 443. On the VIP using port 80, include an irule for the http to https redirect. (You can disregard the other parameters but this should get you in the right direction)

     

    ltm virtual yoursite_80 { destination 123.456.78.9:http ip-protocol tcp mask 255.255.255.255 pool yoursite profiles { http { } tcp { } } rules { http-to-https } source 0.0.0.0/0 source-address-translation { type automap } vs-index 26 }

     

    ltm virtual yoursite_443 { destination 123.456.78.9:https ip-protocol tcp mask 255.255.255.255 persist { cookie { default yes } } pool yoursite profiles { Http_compression { } Http_compression-compression { } yoursite { context clientside } tcp { } } source 0.0.0.0/0 source-address-translation { type automap } vs-index 25 }

     

    ltm rule http-to-https { when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] } }

     

  • Sorry,

    Just saw in your post that you mention custom tcp ports. On top of the response from Chris, you should use the following irule instead :

    when HTTP_REQUEST { 
        HTTP::respond 302 Location "https://[getfield [HTTP::host] ":" 1]:9443[HTTP::uri]" 
    }
    
  • Hello,

     

    As you have custom ports the generic irule provided within bigip will fail but you can use ltm polocies to redirect requests to your https Virtual Server.

     

  • Hello,

     

    As you have custom ports the generic irule provided within bigip will fail but you can use ltm polocies to redirect requests to your https Virtual Server.