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...
Andy_McGrath
Jan 10, 2018Cumulonimbus
Your iRule is almost correct but logic needs to be change from OR to AND:
when HTTP_REQUEST {
if {[matchclass [string tolower [HTTP::uri]] contains Allowed_uri] and [matchclass [IP::client_addr] equals Allowed_IP]} {
return
} else {
log local0. "---CLIENT IP---[IP::client_addr] URI is [HTTP::uri]"
drop
}
}
reversing the logic, like MrPlastic has done, you can do the same with less using not and logic OR:
when HTTP_REQUEST {
if {(not [matchclass [string tolower [HTTP::uri]] contains Allowed_uri]) or (not [matchclass [IP::client_addr] equals Allowed_IP])} {
log local0. "---CLIENT IP---[IP::client_addr] URI is [HTTP::uri]"
drop
}
}
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