Forum Discussion
Albert__Tase_70
Nimbostratus
Jan 03, 2007Need help converting form 4 to 9
if (http_host matches_regex "demo.nature.com") {
use pool demo
}
else if (http_host matches_regex "xml.nature.com" or http_host matches_regex "palgravexml.nature.com") {
use ...
Jan 03, 2007
Stay away from regular expressions if you can at all help it. Using the switch statement with file globbing (-glob) or the starts_with/ends_with/contains operators can cover most of the cases where users use regular expressions. In your case you are just doing a straight string compare so regular expressions are way overkill.
Here's an example of your rule using the switch statement.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"demo.nature.com" {
pool demo
}
"xml.nature.com" -
"palgravexml.nature.com" {
pool Autonomy
}
default {
discard
}
}
}-Joe
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
