Forum Discussion
kco
Altostratus
Apr 01, 2009question about matchclass and "contains"
I would like to use matchclaass function with the "contains" operator. We want to shunt requests from Googlebot User-Agent to a separate pool of servers. I've searched DevCentral and found many examples to use as a model.
My question is about whether to use:
matchclass
or
matchclass
The page http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass.html has a caution and says to use the former syntax for the type of comparison that we would like to do.
Quote:
This example will will return the index of the first row that has the string "green" anywhere in it:
[matchclass $::data_group contains "green"]
EndQuote:
Yet every iRule example that I found on the site has the $::data_group on the right hand side of the contains operator. And even the contains example on that page above has it on the rhs.
Searches on Google did not yield a reference that resolves the dilemma. Can anyone in the Forum answer this for me?
Thanks.
...Kevin O'Neil
OCLC Inc.
Dublin OH USA
- The_Bhattman
Nimbostratus
I personally would choose "[matchclass $::data_group contains "green"]. My thoughts are that if you mispell in the datagroup you don't render your iRule invalid now or down the road. - spark_86682Historic F5 AccountIt's not that either form is right or wrong, it's that they do different things, and you should use the form that does the thing you want.
when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool slow_webbot_pool } else { pool default_pool } }
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