Forum Discussion
Marcel_Jorba_62
Jul 26, 2011Nimbostratus
How to block a specific URL
My setup is balancing 2 servers for all ports.
These servers host a web server
I need to block a very specific URL on these servers, blocking it or forwarding the requester user to...
The_Bhattman
Jul 26, 2011Nimbostratus
Hi Marcel,
Unfortunately you cannot block something that specific without a iRule but you can build an irule that hopefully is easier to update when you want to expand what you want to block.
I typical uri block would look something like the following:
Expanding this to include different URIs using the switch command
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/path1" -
"/path2" -
"/path3" -
.
.
.
"/PathN" { drop }
}
}
Taking this further you may have an even larger list you can use datagroups
class blockthis {
"/path1"
"/Path2"
}
when HTTP_REQUEST {
if {[class match [string tolower [HTTP::uri]] equals blockthis } {
drop
}
This allows you to continue to add URI's you want to block. You can also replace "drop" with HTTP::redirect "http://redirected.com/uri" which can be used to redirect the client instead of dropping the connection or you can write up a sorry page response for example
HTTP::respond 200 content "We are sorry, but the site you are looking for is temporarily offline for services, please try back later
If you feel you have reached this page in error, please try again."
I hope this helps,
Bhattman
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