iRules - Remove WWW AND replace "Host"
Hello,
I am sorry if this is very easy to do, but I am really new to F5 and iRules.
We have an iRule in place which replaces the domain part of a URL. This rule is below.
The situation is this: If a user visits location1.domain1.com , it translates to location1.primarydomain.com, and then our webserver handles redirection to .
That part is working great. HOWEVER, if a user appends www in front of the URL, i.e. , the URL is then , and our webserver doesn't know what do to.
I would like the iRule to remove www, and then translate it to location1.primarydomain.com (if you know what I mean).
Is this possible?
when HTTP_REQUEST { if { [HTTP::host] ends_with ".domain1.com" } { HTTP::header replace "Host" [string map {".domain1.com" ".primarydomain.com"} [HTTP::host]] } }