Forum Discussion
networkdawg_303
Nimbostratus
Dec 14, 2016iRules - 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...
Kai_Wilke
MVP
Dec 15, 2016Hi networkdawg,
you may try the iRule below.
It uses the
[domain] command to extract the first three dotted domain elements (e.g. four.third.second.frist) from the requested HOST-header, then passes the information to a[getfield] command to extract the third element and adds the new second and first dotted domain elements via TCL concentation...
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] ends_with ".domain1.com" } then {
HTTP::host "[getfield [domain [HTTP::host] 3] "." 1].primarydomain.com"
}
}
Cheers, Kai
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