Forum Discussion
AngryCat_52750
Nimbostratus
Nov 30, 2012Check URI and then drop
We are looking to setup an irule that would only permit a specfic URI and drop any other requests..
How do i script the part to do the "dropping"?
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/abc" } {
pool abc_servers
else
???
}
}
4 Replies
- Kevin_Stewart
Employee
The simplest approach might be something like this:when HTTP_REQUEST { if { not ( [string tolower [HTTP::uri]] starts_with "/abc" ) } { drop } }
You probably already have the pool defined in the virtual server, so you don't need to assign it here. The 'drop' command is also a bit harsh. You can instead either redirect the user (HTTP::respond 302 Location "blah"), or sending them some friendly HTML (HTTP::respond 200 content "go away!"). - Christopher_Boo
Cirrostratus
End it with.....
default {
reject
}
Chris - Brian_Deitch_11Historic F5 AccountPersonally I believe a switch would scale better and would be easier on the eyes
ltm rule ir_bdizzle { when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { */enter/url/here* { pool pool_a_80 } */abc* { pool pool_abc_80 } default { drop } } } } - AngryCat_52750
Nimbostratus
Sweet!! thanks for the quick replies guys!!
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