Forum Discussion
CGI
Altostratus
Oct 08, 2010Modifying irule for geofiltering to include allowed ips
Hi iam new to both F5 and irules, and we are trying to achieve a modification of a exsisting irule that is used for geofiltering.
We would like to combine the possability to include certain ip ad...
Chris_Miller
Altostratus
Oct 08, 2010Good call Hoolio
when CLIENT_ACCEPTED {
if {([class match [whereis [IP::client_addr] country] eq allowed_country] or [class match [IP::client_addr] eq allowed_ip])} {
set allowed 1 }
else { set allowed 0 }}
when HTTP_REQUEST {
if { $allowed eq 1 } {
Uncomment the line below to turn on logging.
log local0. "Valid client IP: [IP::client_addr] - forwarding traffic"
forward }
else {
HTTP::respond 403 content "Not Allowed"
log local0. "Blocked Country client IP: [IP::client_addr] from [whereis [IP::client_addr] country]" } }
IIRC, I needed the "else set allowed 0" or we'll throw TCL errors...I suppose I could use catch, info exists, or check that the value != ""
Thoughts?
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
