Forum Discussion
Ert_27713
Nimbostratus
Jan 21, 2008Irule ACL based on URI
Can someone help me with creating a rule that can filter URI access based on IP address.
Something like
userIP1 can access /userDIR1
userIP2 can access /userDIR2
userIP...
hoolio
Cirrostratus
Jan 21, 2008I expect you'd get a parser error when trying to save that rule because the HTTP::uri command isn't valid in the CLIENT_ACCEPTED event. To access the HTTP request headers, you should use the HTTP_REQUEST event. The IP:: commands are still valid there as well, so you can just change CLIENT_ACCEPTED to HTTP_REQUEST.
Is user IP just one IP or is it a set of hosts and/or networks? If it's just one IP or network, you can use IP::addr (Click here) to perform the comparison:
if {[IP::addr [IP::client_addr] equals 1.2.3.4] and [HTTP::path] equals /userDIR1}{
If you have a set of networks or hosts you want to compare for $::userIP1, then the matchclass method you were using will work well.
Also, you can use HTTP::path instead of HTTP::uri to get the URI minus the query string.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
