Forum Discussion
Livius
Cirrus
7 years agoSmall iRule help
Small iRule help
Hi guys,
I want to send a HTTP response based on the client source IP address, it is just for a test, but the iRule validation fails. I prefer to keep it simple, I know I c...
youssef1
Cumulonimbus
7 years agoHi,
you can try this, it will be more easy to manage your client IP... As you can noticed you can add additional client IP in multivalue var or delete (it will allow you to don't touch condition, just add or delete client IP)....
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
set host [string tolower [HTTP::host]]
array set client_ip {
clientip1 "64.122.88.0/8"
clientip2 "180.10.134.140.0/12"
}
foreach ip [array names client_ip] {
if { [IP::addr [IP::client_addr] equals $client_ip($ip)] } {
log local0. "client ip: [IP::client_addr] - client grp matching: $client_ip($ip) - url: $host$uri"
HTTP::respond 200 content "what's you want to display"
}
}
}
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