Forum Discussion
Jeremy_C_Russel
Nimbostratus
Nov 14, 2011Possible issue with an iRule
Greetings all.
I wanted to get some eyes on this particular rule I've setup. The premise is to take urls in the form of http://string.domain.com or http://www.string.domain.com, capture "st...
hoolio
Cirrostratus
Nov 14, 2011If you're seeing connection resets with an iRule, check the /var/log/ltm file for runtime TCL errors.
However, as Nitass said, you should be able to rework this iRule with string pattern matching to avoid the high CPU costs of regexes. I'm not exactly sure what logic you're trying to implement, but here's a stab at it:
when HTTP_REQUEST {
Remove www. from the host header value if it is present
set host [string map {www. ""} [string tolower [HTTP::host]]]
log local0. "[IP::client_addr]:[TCP::client_port]: Parsed $host from [HTTP::host]"
switch $host {
"domain" -
"wsecure" -
"ssl" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched part of $host, redirecting"
HTTP::redirect "https://www.domain.com/MS/RedirectMS?site=hub&value=$host"
}
}
}
http://devcentral.f5.com/wiki/iRules.switch.ashx
http://devcentral.f5.com/wiki/iRules.getfield.ashx
Aaron
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