Forum Discussion
John_Nootens_45
Nimbostratus
Mar 08, 2005Help me convert 4.x Rule to 9.x iRule
I built a rule based on everything I could find for examples and documentation in the LTM configuration guide and on devcentral, but I'm not able to get around syntax errors. I'll greatly appreciate any help in converting the 4.5.9 Rule below to a 9.0.4 iRule as I've tried here:
THIS IRULE:
iRule PSFT_Rule
when CLIENT_ACCEPTED{
if { [HTTP::uri] matches_regex "/psreports"} {
pool PSFT_Reports
} else {
pool people_soft
}
}
GAVE THESE ERROR MESSAGES:
01070151:3: Rule [PSFT_Rule] error:
line 1: [wrong args] [when CLIENT_ACCEPTED{]
line 2: [command is not valid in the current scope] [if { [HTTP::uri] matches_regex "/psreports"} {
pool PSFT_Reports
} else {
pool people_soft
}]
line 7: [command is not valid in the current scope] [}]
HERE WAS THE ORIGINAL 4.5.9 Rule:
rule PSFT_Rule {
if (http_uri matches_regex "/psreports") {
use pool PSFT_Reports
}
else {
use pool people_soft
}
}
- First of all, you don't specify the rule name in the rule itself in the GUI. Second, it looks like there must be a space between the event name and a curly brace. Another thing is that you might want to use the "starts_with" or "contains" operators so you don't incur the overhead of a regular expression search.
when CLIENT_ACCEPTED { if { [HTTP::uri] contains "/psreports"} { pool PSFT_Reports } else { pool people_soft } }
- Now that I think about it, you will want to be triggering this on the HTTP_REQUEST event. It's my understanding that the URI is not known at the time of session establishment.
when HTTP_REQUEST { if { [HTTP::uri] contains "/psreports"} { pool PSFT_Reports } else { pool people_soft } }
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