php - Fastest way to 403 in Zend framework


What is the best way to reject a request coming from malicious scripts? I have a Zend application with modules. I have a list of URL's that the scanners are dialing, such as, /webmail, /cpanel, etc. Right now, they are getting 404's, clogging up my error log. I'd like to 403 them from within the application. (Unless there is a better way to handle that)?

What is the fastest way to 403 within Zend, so it doesn't churn through the dispatch cycle unnecessarily? I am doing below in a plugin but I am not sure this is the best way:

public function preDispatch(Zend_Controller_Request_Abstract $request)
    if (malicious request) {

Thanks for any suggestions!




Check out the Zend Controller Action Helper called Redirector: It'll do the same thing as your plugin, but that doesn't necessarily make it any faster.




If you know what the bad request URI's look like, you could send them directly to some custom static error page using mod_rewrite rules. Enter the rules before your rule that sends the request to index.php and those requests would never hit your application.

RewriteEngine On
RewriteRule ^/ /errorpage.php [L]
RewriteRule !(phpdoc|docs)|\.(js|ico|gif|jpg|png|css|html)$ /index.php

People are also looking for solutions to the problem: debugging - Using inclued php pecl extension


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.