Forum Discussion
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
- Yann_Desmarest_
Nacreous
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)
- Yann_Desmarest_
Nacreous
sorry, the correct irule name is "_sys_https_redirect" - Shawn_Roman_262
Nimbostratus
Thanks, I will give this a shot a update you accordingly.
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)
- sorry, the correct irule name is "_sys_https_redirect"
- Shawn_Roman_262
Nimbostratus
Thanks, I will give this a shot a update you accordingly.
- Chris_Olson
Nimbostratus
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]" }- Yann_Desmarest_
Nacreous
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.
- Yann_Desmarest_
Nacreous
Ltm policy !
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.
- Ltm policy !
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com