Forum Discussion
cody8411_186897
Jan 29, 2016Nimbostratus
Handling www with host name redirects in iRule
I'm trying to figure out how I can handle the following situation. The section of the iRule below is for redirecting to a different URL based on a hostname. Our organization has purchased multipl...
Tim_K_92675
Jan 29, 2016Cirrostratus
If you consistently maintain your data group names without 'www.' then you could pull in the requested hostname, strip off www. if it exists, and then run it through the data group. Something like this (untested)...
when HTTP_REQUEST {
if { [string range [HTTP::host] 0 3] eq "www." } {
set hostname [string range [HTTP::host] 4 end]
} else {
set hostname [HTTP::host]
}
if {[class match $hostname eq group_80_host_redirect]} {
HTTP::redirect [class match -value [HTTP::host] eq group_80_host_redirect]
}
}
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