Forum Discussion
Brian_DeKemper_
Nimbostratus
Feb 03, 2007HTTPS to HTTP redirect
This one is a little different, but I'm trying to redirect traffic on a 443-Virtual Server over to a port 80 Virtual Server.
I have an 'HTTP to HTTPS redirect' iRule, but I'm in a situation where I want to do the exact opposite. Anyone got an example iRule I can use?
Thanks
Brian
- Jeff_Mattson_44
Nimbostratus
Assuming you need both virtuals, and not just a simple SSL termination, this might help. - John_Klemm_4418
Nimbostratus
Colin your irule is correct. I am currently using the same in my test lab. - wmazanek_98800
Nimbostratus
I tried to configure two virtual servers - one for ssl termination and second for switching based on tcp:collect data, just like Jeff wrote, but I got problem with loopback vlan. - hoolio
Cirrostratus
I'm not sure about the loopback cable hack, but in 9.4.0 and later versions, you can specify in an iRule that the destination for a request should be another virtual server on the same BIG-IP, using the 'virtual' command (Click here). - wmazanek_98800
Nimbostratus
Yes I am using 9.4.2 - Eric_Oakeson_68
Nimbostratus
When I tried this iRule, I got an error saying that I had to put an http profile on the virtual server in order to get it to work. I think it needs that to key off the HTTP_REQUEST. So, I did that, but it broke all https traffic using that current virtual server. As soon as I removed the profile, traffic was restored. - hoolio
Cirrostratus
oak2207, if you're trying to redirect a client to HTTP, you would need to decrypt the client - VIP SSL using a client SSL profile and add an HTTP profile to interpret the traffic as HTTP. What criteria are you trying to use to redirect some traffic to HTTP and leave some encrypted? It may be possible to selectively apply a client SSL profile to issue a redirect, but leave the rest of the traffic encrypted. Else, you could decrypt all client side traffic, redirect what you need to and re-encrypt the rest that is sent to the server using a server SSL profile. - Eric_Oakeson_68
Nimbostratus
Aaron, - JRahm
Admin
As Aaron said in his previous post, you can't redirect HTTPS to HTTP on the LTM without first decrypting the traffic. The LTM needs the traffic in the clear in order to evaluate the contents and issue the redirect. In your environment, if the LTM will not be offloading SSL, an ssl-enabled pool member should remain available to server the maintenance page. - hoolio
Cirrostratus
Citiizen_elah is correct. Though, if you can import the SSL cert and key, there is another option. If you want to pass the SSL through LTM encrypted during normal operations but send a redirect during maintenance, you could adapt this example (Click here) to read a "maintenance" flag. If the maintenance variable was enabled, then LTM would decrypt the SSL and respond with a redirect.when CLIENT_ACCEPTED { Set this flag to 1 to decrypt the SSL and send a redirect to the client. Set to 0 to pass the SSL through without decrypting it. set maintenance_redirect 1 log local0. "[IP::client_addr]:[TCP::client_port]: Received connection with maintenance flag set to $maintenance_redirect" Check if the maintenance flag is disabled (set to 0) if {$maintenance_redirect==0}{ Disable the client SSL profile so the HTTPS traffic is passed through encrypted to the node SSL::disable Disable the HTTP profile as we're not going to redirect this request HTTP::disable log local0. "[IP::client_addr]:[TCP::client_port]: Maintenance flag is disabled" } } when HTTP_REQUEST { The HTTP_REQUEST event is only triggered if the maintenance flag is enabled and the client SSL and HTTP profiles are left enabled Redirect the client HTTP::redirect https://maintenance.example.com log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting request" }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects