Forum Discussion
jokragly
Nov 03, 2010Nimbostratus
iRule for URI ACL
Good afternoon. We are getting desperate trying to find a solution to allow specific URIs and deny all other traffic.
Basically what we are after is to allow access to 5 specific directorie...
hooleylist
Nov 05, 2010Cirrostratus
That could be horribly inefficient to loop through a datagroup and run a regex operation on each element. I'd go back to George and Chris' examples using a datagroup and the iRule which uses starts_with. Make sure to remove the $:: prefix from the datagroup name in the iRule as that won't work in 10.x.
class mycompany_allowed_urls {
{
"/dealer/"
"/help/"
"/image/"
"/login/"
"/user/"
}
}
when HTTP_REQUEST {
if { ![class match [string tolower [HTTP::uri]] starts_with blue] } {
HTTP::redirect "http://www.google.com/"
}
}
I'm not sure whether the web app is case sensitive or not, so I set the URI and the datagroup entries to lower case.
Aaron
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