Forum Discussion
Irule to redirect all traffic to one domain to another.
Currently, have website.mydomain1.com that does simple http to https redirect. We are decommissioning mydomain1.com and moving to website.mydomain2.com. I would like to set my original website.mydomain1.com to redirect to the new domain using the 80/443 virtual server (in case some have saved the actual https: bookmark). I know a CNAME would probably create an SSL issue...I was am going to change the original server to port 0 to grab all traffic requests but any idea how the irule would look to redirect the URL? to mydomain2?
- Kevin_Stewart
Employee
It will generally depend on where everything lives. The easiest thing would be if website.mydomain1.com and website.mydomain2.com were on separate VIPs with separate IPs. In that case, any request to website.mydomain1.com could simply be HTTP redirected to website.mydomain2.com (to the other VIP). You'd want to keep the separate 80 and 443 VIPs though, as you'd need to know whether or not to decrypt before injecting an HTTP redirect (you can insert a redirect in an encrypted packet).
If the two URLs live on the same VIP (same IP), then it gets a little trickier. You still need to keep the website.mydomain1.com SSL certificates alive so that you can decrypt and inject a redirect without the user getting a certificate error. To do this you'd attach both client SSL profiles to the VIP and assign each a corresponding Server Name value that corresponds to website.mydomain1.com or website.mydomain2.com. The VIP will select the correct profile and server cert based on the SNI in the client's request. Then you can use an iRule that looks at the HTTP::host value, and if website.mydomain1.com, issue a redirect to website.mydomain2.com. Also keep a running log of when users access the site via website.mydomain1.com so you know when it's safe to remove the old client SSL profile and redirect iRule.
- TomNSCPO8_12229
Nimbostratus
when HTTP_REQUEST { Redirect from / to actal URL. HTTP::redirect https://website.domain1.com }
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