Limit HTTP VERBS on Apache2

Posted by user72295 on Server Fault See other posts from Server Fault or by user72295
Published on 2011-02-26T11:32:14Z Indexed on 2011/02/26 15:26 UTC
Read the original article Hit count: 328

Filed under:
|

I am trying to limit the use of certain HTTP verbs on my site. I entered the following into my VirtualHost config file within the Directory element:

<Limit GET POST HEAD>
 Allow from all
</Limit>
<Limit PUT DELETE OPTIONS>
 Deny from all
</Limit>

This seemed to work but with unexpected results:

I ran the following telnet/HTTP commands before and after this change,

open server 80
OPTIONS server/abs_path HTTP/1.1
User-Agent: Telnet/1.0
Host: server

before the change I received a successful response with the Allowed headers.

After the change, however, I was expecting to receive a 405 'Method not allowed' response but rather I received a 403 'Access Forbidden' response.

What do I need to change in apache to return the 405 HTTP response?

Many thanks

© Server Fault or respective owner

Related posts about apache2

Related posts about http