Forum Discussion
sandy16
Altostratus
May 09, 2016iRule for matching 2 x Data-groups
Hi experts, I have two data-groups. One is type string' which contains URIs called - Allowed-URIs and the other is type ipaddress' which contains some internal subnets called - Allowed-IPs. Can yo...
Hannes_Rapp_162
Nacreous
May 09, 2016Nothing too complex. A nested IF-condition will do.
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::uri]] eq "Allowed-URIs" ] }{
if { [class match [IP::client_addr] eq "Allowed-IPs" ] }{
Do not interfere (Allowed)
return
} else {
Not allowed
drop
}
}
}
If you're going to use my solution, check to make sure that your Allowed-URIs definitions are all lower-case (or just remove the 'string tolower' function if you need case-sensitive matching).
JRahm
Admin
May 09, 2016I prefer the positive match as well for readability, but for efficiency, you could eliminate the else by reversing the match on the nested if (not [class match [IP::client_addr...)
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