Forum Discussion
AlexDeMarco
Nimbostratus
Sep 25, 2012How to narrrow the match
Here is a small snippet of my code:
([string tolower [HTTP::uri]] starts_with "/ca") ||
We have an application where the context is just /ca so this is working fine for it. However...
Michael_Yates
Nimbostratus
Sep 27, 2012Changing your matching order would probably be your best bet. Regular expressions can get expensive in processing times and efficiency loss.
I would suggest What Lies Beneath's suggestion. Using a switch statement you can go from the more specific to the generic to prevent things from firing and causing problems.
You'll will probably need to follow up your pool decisions with a return statement as well to prevent the next event from interfereing with the previous.
Try something like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/capitals*" { pool firstpool; return }
"/capital*" { pool secondpool; return }
"/caps*" { pool thirdpool; return }
"/california*" { pool fourthpool; return }
"/ca*" { pool fifthpool }
default { pool defaultpool }
}
}
Hope this helps.
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
