Mark_Burchard_5
Mar 21, 2006Nimbostratus
iRule to limit access to webserver directory by client IP
Hi all,
First time posting here, and you'll probably laugh and shake your heads at this simple problem, but hopefully I'll learn. I have searched for similar iRules and can't seem to find them.
This is my issue: I'm looking to deny access by client ip to a certain directory on a site (eg. host.domain.tld/Example. For clients originating from the correct IP range(s), it would pass them through. For those outside the allowed range, it would redirect them to the site's base URI.
Here is what I have so far:
when HTTP_REQUEST {
if { [matchclass [HTTP::uri] contains "/Example"] }
if { [[IP::client_addr] not equals mask "10.0.0.0\24"] }
HTTP::respond 301 Location "http://host.domain.tld/"
}
The iRule validator has this to say about that rule:
line 3: [missing a script after "if"] [ ]
line 5: [missing a script after "if"] []
Am I even on the right track here? Has anybody ever tried to use an iRule this way?
Thanks very much in advance for any help you can give.
-Mark