Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I disallow POST requests on a certain page of the website?

Like disallow POST on http://site.com

but allow it on subpages, like http://site.com/whatever or http://site.com/post.php


The problem is an old script that was handling such requests. This script is now inactive, however such requests still come, and burden the server. I want to somehow block them

share|improve this question

1 Answer 1

It is not recommended to use the <Limit> directive for access control in most cases, but in your situation this may be your best option:

<VirtualHost>
  ServerName example.net
  ...

  <Location /post.php>
    <Limit POST>
      Order deny,allow
      Deny from all
    </Limit>
  </Location>
</VirtualHost>

The code above will return 403 Forbidden for POST requests for http://example.net/post.php. More information about the Limit directive.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.