Forum Discussion
Michael_A__Fied
Nimbostratus
May 21, 2010iRule using URI classes to restrict access
(version 9.4.7)
I have been restricting access to certain pools via the following iRule statement:
if { [matchclass [IP::client_addr] equals $::TrustedIPs] and [matchclass [HTTP::path] starts_with $::SomeURIs] } {
pool secure_pool
return
}
else {
pool public_pool
return
}
The SomeURIs class contains elements like "/foo" and "/bar".
It seems like when I use a double slash, i.e. "http://myvirtualip//foo" the iRule statement doesn't come into effect.
Thoughts, considerations?- Michael_Yates
Nimbostratus
The [HTTP::path] starts at the first "/" so you will either have to account for it in your matchclass or add to your iRule to look for it and remove it.HTTP::uri [string map {"//" "/"} [HTTP::uri]]
- Michael_A__Fied
Nimbostratus
Posted By Michael Yates on 05/21/2010 03:04 PM The [HTTP::path] starts at the first "/" so you will either have to account for it in your matchclass or add to your iRule to look for it and remove it.HTTP::uri [string map {"//" "/"} [HTTP::uri]]
- Michael_A__Fied
Nimbostratus
Even more importantly, what about replacing any amount of slashes with a single one? How can I string map look for a series of slashes and replace them with only one? - hoolio
Cirrostratus
string map can't recursively perform substitutions:
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