Forum Discussion
iRule to block IP and URL
Hi,
I want an iRule to block a set of IP's hitting a set of url's and log the blocking Could you please check the below iRule and update if any error.
when HTTP_REQUEST {
set url [HTTP::host][HTTP::uri]
if {[class match $url contains blocklist_url] and [class match [IP::client_addr] equals restrict_ip]} {
drop
log local0. "Blocking clientIP:[IP::client_addr] trying to access $url"
}
}
2 Replies
- Lee_Sutcliffe
Nacreous
The variable $url will not contain the protocol (HTTP or HTTPS)
It will contain a value such as this:
This isn’t an issue but you need to make sure you have configured your data group to use this format.
Other than that, looks ok. Just try it!
- youssef1
Cumulonimbus
Hi,
It looks ok, you confirm that you ant to block a specific IP AND URL (AND and not OR)?
You can also achieve your need using ltm Policy...
regards
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