Forum Discussion
Peter__Chan_109
Nimbostratus
Sep 30, 2005Rules convert problem from 4.5.12 to v9
Hi folks,
Could anyone please help figure out my problem to convert a rule from v4.5.12 to v9? I'm using the OTCU conversion during an upgrade from v4.5.12 to v9.1 but it always show syntax error...
unRuleY_95363
Sep 30, 2005Historic F5 Account
Here's an example of how to convert one of your other rules:
rule http_redirect {
if (substr(tcp_content(2), 0, 2) == "X") {
use pool test80
}
else {
use pool test84
}
}becomes:
rule http_redirect [
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
if { [TCP::payload] starts_with "X" } {
use pool test80
} else {
use pool test84
}
TCP::release
}
}I'm not sure you need to use substr since you are only extracting the first 2 bytes and the starts_with operator will only compare the first bytes with the provided string. So, this is sort of an optimization, not just a conversion.
Also, your last rule, you shouldn't use matches_regex since in regular expressions, the dot . actually means match anything. I don't actually see any regular expression, so you should simply check for equality using the "eq" operator:
rule webservice {
if { ([HTTP::host] eq "test.domain.com") or ([HTTP::host] eq "www.domain.com")} {
use pool http2_pool
} else {
use pool http_pool
}
}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