zblue_123071
Aug 21, 2013Altocumulus
iRule to Allow Certain Client IP
Hi,
I have a situation where I need to permit certain IPs to access HTTP content, to do this, I have an iRule that is using a switch based off of the client IP like this:
when HTTP_REQUEST {
if { [HTTP::host] contains "my.site.com" } {
switch [IP::addr [IP::client_addr] mask 255.255.255.255] {
"1.2.3.4" {
my-pool
} default {
HTTP::respond 200 content [ifile get AccessDenied]
}
}
}
}
My problem is if I need to allow multiple IPs, I have to repeat several lines of code - is there a more efficient way to do this?
Thank you!