Forum Discussion
Corey_Webb_9791
Nimbostratus
Dec 18, 2007Redirect HTTP to HTTPS without using HTTP_REQUEST trigger
I need to redirect traffic that comes to my VIP as http:\\x.y.z to https:\\x.y.z however since there is no actual HTTP_REQUEST triggered when the request comes in as http I need to trigger this redirect with some other trigger that happens before the request like port or client address but none of these seem to allow for the HTTP::redirect command to be issued. Any Ideas???
Thank you,
Corey
26 Replies
- Corey_Webb_9791
Nimbostratus
I thought the V9 was suppose to do away with the nonsense of having to create 2 VIP to proxy information back and forth. Guess not. - hoolio
Cirrostratus
Also, if you really want to, you can actually do this with a single virtual server. The configuration is slightly more complex compared with configuring one HTTP and one HTTPS virtual server, as it requires an iRule to handle the various scenarios.
To do this, create a single virtual server defined on port 0 (any) with a client SSL profile and an HTTP profile configured. The pool would be made up of web servers accepting HTTP only (port 80). You can then use an iRule to disable the client SSL profile for HTTP requests. Or you can enable the 'non-ssl' option on the client SSL profile to allow HTTP communication to the virtual server through the client SSL profile. You would also want to drop (ignore) or reject (send a TCP reset) to requests not on the HTTP or HTTPS ports. I added an example to the codeshare (Click here).
Aaron - Corey_Webb_9791
Nimbostratus
When I try to use your codeshare I get many errors. Any ideas? - Corey_Webb_9791
Nimbostratus
01070151:3: Rule [WHAT] error: line 29: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 32: [command is not valid in current event context RULE_INIT] [IP::client_addr] line 32: [command is not valid in current event context RULE_INIT] [IP::local_addr] line 32: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 35: [command is not valid in current event context RULE_INIT] [PROFILE::exists clientssl] line 36: [command is not valid in current event context RULE_INIT] [IP::client_addr] line 36: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 36: [command is not valid in current event context RULE_INIT] [IP::local_addr] line 37: [command is not valid in current event context RULE_INIT] [reject] line 39: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 42: [command is not valid in current event context RULE_INIT] [IP::client_addr] line 42: [command is not valid in current event context RULE_INIT] [IP::local_addr] line 42: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 45: [command is not valid in current event context RULE_INIT] [PROFILE::exists clientssl] line 53: [command is not valid in current event context RULE_INIT] [IP::client_addr] line 53: [command is not valid in current event context RULE_INIT] [IP::local_addr] line 53: [command is not valid in current event context RULE_INIT] [TCP::local_port] line 54: [command is not valid in current event context RULE_INIT] [reject] - Corey_Webb_9791
Nimbostratus
The 2 server idea works and I have that working now but I would love to make the single server I rule work but I am not sure what I am missing. Thanks for the input and I hope to hear more about this single server set up. Thanks - hoolio
Cirrostratus
Sorry... somehow in my copying/pasting, I lost the line with 'when CLIENT_ACCEPTED'. Can you give the updated version a try? (Click here)
Thanks,
Aaron - Corey_Webb_9791
Nimbostratus
Thanks it looks like the code is accepted in the Irule but it is still not giving the desired result and does not appear to be processing according to the stats. I guess I will just have to use the 2 server scenario unless you have any other ideas.
Thanks - Corey_Webb_9791
Nimbostratus
Got it working!!!!!
Hoolio is the man
Thanks alot. - hoolio
Cirrostratus
Glad to hear you got it working. Out of curiosity, what was the problem and fix? I had adapted that rule from a more complex one for ASM and hadn't tested the modified version fully.
Aaron - Corey_Webb_9791
Nimbostratus
Sorry for the delay in response I have been finally making progress and forgot to update you. Anyways the problem was simply a typo I had the wrong uri in and hence it did not work. Your code is awesome though. Thanks again
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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