Forum Discussion
ngaze_66812
Nimbostratus
Sep 14, 2011URL restrictions for public and class
What I'm attempting to do with the below iRule (and struggling to accomplish) is to allow public addresses to connect to the servers after coming in with a /home request, but then to restrict access to certain networks when requesting /web-services. All other requests should be getting rejected. I've been tweaking this rule trying to get it to work for quite a while and after applying in it's current state it is still allowing access to /*. Any help on this is appreciated.
when HTTP_REQUEST {
if {[HTTP::uri] contains "/home" } {
pool server_pool
}
elseif {[HTTP::uri] contains "/web-services"} {
if {[matchclass [IP::client_addr] equals allowed_networks] }{
pool server_pool
}
else {
reject
}
}
else {
reject
}
}
1 Reply
- Michael_Yates
Nimbostratus
Hi ngaze,
I am making a few assumptions, so correct me if I am wrong. I am assuming that your URI starts with /home or /web-services for the comparisons that you are looking to qualify for.
I am also assuming that you are on v10.x.x because of the way that you listed your class ("allowed_networks") in your iRule, so I changed the "matchclass" to "class match". If you are still on on v9.x.x you will need to switch it back to "matchclass".
Try this and see if it works for you.when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/home*" { pool server_pool } "/web-services*" { if { [class match [IP::client_addr] equals allowed_networks] }{ pool server_pool } } default { reject } } }
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