HTTP to HTTPS redirect over the same port

Hello,

i hope you can help me. I need an http to https redirect to the same port. For example I enter the URL http://dev.intern.com:25001 and I want to get redirected to https://dev.intern.com:25001. I tried a second virtual server but this didn’t work because the loadbalancer can’t have two the same IP and ports for a second server which redirects it with an irule to the https virtual Server which is understandable.

Thank you already and best regards!

Where are you terminating the SSL - on F5 or servers ?

I am not sure if you know this but you can have a set up like this: VS:80 VS:443

Both VS can then be attached to a common pool with pool members listening on port 25001 and you can have HTTP to HTTPS redirect iRule on VS:80

Hello,

we found the solution for the Problem. A few years ago a person had the same problem:

So you just have to use the iRule:

when CLIENT_ACCEPTED { 
    set https 0 
 } 
 when CLIENTSSL_HANDSHAKE { 
    set https 1 
 } 
 when HTTP_REQUEST { 
    if {not ($https)}{ 
       HTTP::redirect https://[HTTP::host][HTTP::uri] 
    } 
 }

And to activate non-SSL in your SSL Profile under Local Traffic → Profiles → SSL → Client → (Profile you are using)

After that you are able to set the iRule on your SSL virtual server.