Forum Discussion
maximillean_953
Nimbostratus
Feb 04, 2014Irule filtering via uri with depth
This is what i want to do and try to do but no joy.
I try to filter a request with depth so for example url is;
a.x.com/s/control or
a.x.com/xyz/zyx/control
So this is where i want to apply the...
Kevin_Stewart
Employee
Feb 04, 2014It looks like you've stumbled upon an unusual behavior. First, if you want to get the value of a single path element with the URI::path command, use the same start and end values.
if { [URI::path [HTTP::path] 2 2] equals "/control/" }
Where that appears to break down though is when looking at a last path element that doesn't end with /, in which case URI::path simply returns "/".
http://x.y.com/a/b/c/d/control/
vs.
http://x.y.com/a/b/c/d/control
I was able to work around this by basically turning the path into a list and evaluating specific list elements like so:
when HTTP_REQUEST {
if { ( [lindex [split [HTTP::path] "/"] 2] contains "control" ) or ( [lindex [split [HTTP::path] "/"] 3] contains "control" ) } {
if { not ( [class match [IP::client_addr] equals ss_allowed_address] ) } {
reject
} else {
return
}
}
}
Let me know if that works.
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