Forum Discussion
Don_Noel_23994
Nimbostratus
May 10, 2006HTTP Redirects
I am looking to create an iRule that does redirection based off a class list. Below is a break down of the requirements. There was an earlier attempt to put an iRule together and it is located at th...
Deb_Allen_18
May 10, 2006Historic F5 Account
Hi Don --
I think the "domain" and "findstr" functions might solve both of your dilemmas.
http://devcentral.f5.com/wiki/default.aspx/iRules/domain.html
http://devcentral.f5.com/wiki/default.aspx/iRules/findstr.html
Use domain to extract the last field from the domain name, regardless of the number of subdomains in the name:
log local0. [domain www.company.co.uk 1]generates the following output:May 10 15:59:46 tmm tmm[1043]: Rule : ukUse findstr to extract only the characters following "www." in the hostname:
log local0. [findstr www.company.co.uk "www." 4] generates the following output:May 10 15:59:46 tmm tmm[1043]: Rule : company.co.ukYou'll need to wrap the findstr in an appropriate condition so you don't get a null string for names NOT starting w/www.:
if {[HTTP::host] starts_with "www." }{
log local0. [findstr www.company.co.uk "www." 4]
} peace
/deb
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
