Forum Discussion
R_Marc
Nimbostratus
Apr 28, 2014Odd behavior on regsub in iRule
I have a switch in an irule to clean up some bad decisions made by developers.
Here is the trimmed down version where the problem occurs, with some debug logging.
ltm rule rmarc-test-rule {
...
Apr 29, 2014
Hi!
Maybe this is not the answer you're looking for, in which case we can adjust it a bit.
A few suggestions:
- Try to avoid the -sub switch if you can as it demotes the LB to a use single core processing.
- Use the is_redirect check to avoid using costly regsub commands in vain.
A rule suggestion (providing that you will always replace the location with the same url):
when HTTP_RESPONSE {
Ferret out bad location headers
if { [HTTP::is_redirect] } {
set location [string tolower [HTTP::header values Location]]
if { $location contains "test" || $location contains "a401" } {
log local0. "Header before: [HTTP::header values Location]"
HTTP::header replace Location "dtl.somedomain.com"
log local0. "Header after: [HTTP::header values Location]"
}
}
}
/Patrik
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