Forum Discussion
Sean_O_Brien_65
Nimbostratus
Apr 13, 2010iRule forward URL to different domain for http and https
We are planning a website cutover to another (new) existing domain, both going through the F5 currently...
This weekend I will change the DNS to point to different VS on F5 and at that point I will be implementing an iRule to change the old url request (such as in peoples bookmarks, etc...) to point to the new url with a different domain.
I created a test VS and pool to test the iRule I have below, and I believe my problem is forwarding both http and https requests with one iRule.
This is what I have now:
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"domain1.com" { HTTP::redirect "https://domain1.domain2.com"
}
"www.domain1.com" {
HTTP::redirect "https://domain1.domain2.com"
}
}
}
As it stands, when I try to go to my "domain1.com" after updating my hosts file to point to test VS, I get page not found... Also, if I try https://www.domain1.com, I get an SSL error and it stays as domain1.com in the address bar. Thanks for any help!
- hoolio
Cirrostratus
Hi Sean,when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "domain1.com" - "www.domain1.com" { HTTP::redirect "https://domain1.domain2.com[HTTP::uri]" } } }
- Sean_O_Brien_65
Nimbostratus
I did apply iRule to HTTP and HTTPS VIP after troubleshooting, but that made no difference. - hoolio
Cirrostratus
If blah.domain2.com and another hostname like domain1.com or www.domain1.com are resolving to the same VIP, then clients will get a mismatched cert warning on HTTPS requests when trying to access a hostname that the cert isn't issued for. You would want to have a cert installed which matches the hostname(s) that the client is making the request to--not the domain that you're redirecting the clients to. - Sean_O_Brien_65
Nimbostratus
I think I just found my error... I had inadvertently set the SSL client and SSL server profiles to my HTTP VIP... That was causing the block or dropped requests... - hoolio
Cirrostratus
That sounds about right. Forwarding to a second VIP won't help with trying to handle multiple certs on a single client facing IP address:port combination as you'd need to try to decrypt the SSL on the first VIP before knowing which traffic to forward to the second VIP. Sending the "wrong" cert on the first VIP to the client will trigger the mismatched cert warning on the browser before you can send the request to the second VIP with the "correct" cert.
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