Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable PUT and DELETE methods on Apache 2.4

Tags:

apache

lamp

I'd like to enable on my Apache 2.4 under linux the PUT and DELETE methods. When clients try to invoke such methods I get a "405 Method Not Allowed" as answer.

On server side my PHP script handle such requests but it seems filtered by the server itself (that's makes the difference from the similar already answered question - Moreover other questions seems to refers to an old version of Apache).

Can I manage some configurations on .htaccess file or I have to modify the .conf files under /etc/apache2?

Thanks a lot.

like image 874
Francesco Piraneo G. Avatar asked May 27 '16 13:05

Francesco Piraneo G.


1 Answers

Try the following changes on your server:

Open "/etc/httpd/conf/httpd.conf" and look for the following blocks:

<Limit GET POST OPTIONS PROPFIND>
  Order allow,deny Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
   Order deny,allow Deny from all
</LimitExcept>

Then just add PUT and DELETE after PROPFIND. Then Restart httpd by "/sbin/service httpd restart" or service httpd restart.

Note: In some servers , mostly the ones with a control panel (DA,cPanel,..) you may change this file :/etc/httpd/conf/extra/httpd-directories.conf

I hope it solves your problem.

like image 189
Sinai Avatar answered Sep 22 '22 12:09

Sinai