Forum Discussion
Lee_Wooderson_1
Jan 10, 2018Nimbostratus
Irule logic question
when HTTP_REQUEST {
if { ([matchclass [string tolower [HTTP::uri]] contains Allowed_uri]) or ([matchclass [IP::client_addr] equals Allowed_IP]) } {
}
else {
log local0. "---CLIENT IP---[IP::cl...
Lee_Sutcliffe
Jan 10, 2018Nacreous
Hi Lee,
I sometimes find it easier to read an iRule (especially when you include NOTs) by breaking the 'or' into separate 'if' conditions. Notice the "!" - this makes the condition a NOT.
So:
IF NOT datagroup URI, IF NOT datagoup IP, drop. (everything else will be allowed)
when HTTP_REQUEST {
if {(![class match [string tolower [HTTP::uri]] contains Allowed_uri])} {
if {(![class match [IP::client_addr] equals Allowed_IP])} {
drop
}
}
}
PS -
matchclass
has been depricated:
https://devcentral.f5.com/wiki/iRules.matchclass.ashx
Lee
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