Forum Discussion
iRule 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 typeipaddress' which contains some internal subnets called - Allowed-IPs. Can you help me create an irule which has the following logic - the URIs in the data-group Allowed-URIs are only accessible from the Allowed-IPs data-group. Else DROP !4 Replies
- Hannes_Rapp_162
Nacreous
Nothing 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
I 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...)
- Hannes_Rapp
Nimbostratus
Nothing 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
I 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...)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
