Forum Discussion
dp_119903
Nov 17, 2015Cirrostratus
Help with RegEx
I am having some difficulty forming the correct syntax (or regex) for an irule.
I need to block some specific URI's if they come from a specific data group. The logic works, but the regex doesn...
- Nov 17, 2015
regex in iRule equals bad news. Try something like this:
elseif { [class match [IP::client_addr] equals block_ip] }{ switch -glob [string tolower [HTTP::uri]] { "/user-experience*" { return } "/user*" - "/admin*" { reject } default { return } } }
dp_119903
Nov 17, 2015Cirrostratus
I did this and it worked...I'll give the above a shot.
when HTTP_REQUEST {
if { not ( [class match [IP::client_addr] equals first_data_group] ) } {
reject
} elseif {([HTTP::uri] starts_with "/admin") and ([class match [IP::client_addr] equals second_data_group])} {
reject
} elseif {([HTTP::uri] equals "/user") and ([class match [IP::client_addr] equals second_data_group])} {
reject
} elseif {([HTTP::uri] equals "/user/") and ([class match [IP::client_addr] equals second_data_group])} {
reject
} elseif {([HTTP::uri] contains "/?q=admin"|"/?q=user") and ([class match [IP::client_addr] equals second_data_group])} {
reject
}
}
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