Forum Discussion
I-rule redirection
we have a DNS record "; this record is actually a CNAME for one of our load balancers which is a1.www2.xyz.com (10.xx.yy.60) This load balancer is HTTPS forced so it goes to HTTPS all the time
Is there any way to tell load balancer that if user requests "; , don't force it to HTTPS and only redirect when the user asks for a1.www2.xyz.com ? right now if we go to "; , it forces HTTPS and certificate is only valid for a1.www2.xyz.com
I Believe irule will help to fix this.Please suggest the irule for same.
- Andy_McGrath
Cumulonimbus
You can redirect from http://www.xyz.com to https://a1.www2.xyz.com with a Policy or iRule with easy on the F5 LTM.
iRule would be as follows, just update the FQDNs and apply to your HTTP Virtual Server:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www.xyz.com"} { HTTP::redirect "https://a1.www2.xyz.com[HTTP::uri]" } }
Alternatively if you want to only redirect if the client sends a request for a1.www2.xyz.com then the following should work:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "a1.www2.xyz.com"} { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
- Samir_Jha_52506
Noctilucent
Yes, You can solve with help of iRule. Please remove default redirection & apply customize iRule like below. Make sure both DNS record should match with A & CNAME.
Let us know if any question?
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www.xyz.com"}{ HTTP::redirect "http://[HTTP::host][HTTP::uri]" } elseif {[string tolower [HTTP::host]] eq "a1.www2.xyz.com"}{ HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
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