Forum Discussion
Bruce_Bronczyk
Altostratus
Jan 27, 2006Undefined procedure error
When trying to add this new iRule to our virtual server I am getting this error:
01070151:3: Rule [pkRouteImageRequests] error:
line 1: [undefined procedure: rule] [rule pkRouteImageRequests
{
when HTTP_REQUEST
{
if { [regexp {.jpg$} [HTTP::uri]] || [regexp {.gif$} [HTTP::uri]] }
use pool parking_image_pool
}
}]
Anyone know what it means? The text for this rule is below, I can't find anything wrong with it.
rule pkRouteImageRequests
{
when HTTP_REQUEST
{
if { [regexp {.jpg$} [HTTP::uri]] || [regexp {.gif$} [HTTP::uri]] }
use pool parking_image_pool
}
}
Thanks!
1 Reply
- iRules don't contain the surrounding "rule rule_name { }" section. That is how it is serialized to the configuration file. If you are adding it from the GUI, only use the event sections, the name is defined in a text box in the GUI. Also, you are missing an opening brace for your if statement.
This code should workwhen HTTP_REQUEST { if { [regexp {.jpg$} [HTTP::uri]] || [regexp {.gif$} [HTTP::uri]] } { use pool parking_image_pool } }
Since you are not really using regular expressions in your search, but are just looking for a string at the end, I'd suggest you replace the regexp with our "ends_with" operator.when HTTP_REQUEST { if { ([HTTP::uri] ends_with ".jpg") || ([HTTP::uri] ends_with ".gif") } { pool parking_image_pool } }
This will perform much better than a regular expression operation.
We recommend avoiding regular expressions when at all possible. In some cases it is unavoidable, but if it can be done with a string search command, it will definitely have less impact on the system.
-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
