1

I'm trying to allow "put" method on my apache 2.2, but what ever i tried (Limit, LimitExcept ...),
i always got the following error :

405 Method Not Allowed
The requested method PUT is not allowed for the URL

This is my http.conf :

<VirtualHost *:80>
    ServerName example.com:80    
    DocumentRoot "D:/test"
    Include "D:/conf/httpd.conf"
    <Directory />
        Order Allow,Deny
        Allow From All
        Options Indexes FollowSymLinks MultiViews
        <LimitExcept GET PUT POST DELETE>
            Order allow,deny
            Allow from all
        </LimitExcept>
    </Directory> 
</VirtualHost>

UPDATE : I readed some related posts like the following :

http://stackoverflow.com/questions/2934554/how-to-enable-and-use-http-put-and-delete-with-apache2-and-php  

but i don't have any script php or cgi.
I just want to redirect http call (get, post, put delete ...) to mock files with mod_rewrite like that :

RewriteCond %{REQUEST_URI} ^/maincall/customer
RewriteCond %{REQUEST_METHOD} PUT
RewriteRule /maincall/customer %{DOCUMENT_ROOT}/mockfolders/PUT/data.json
asicfr
  • 1,061
  • 1
  • 13
  • 30

2 Answers2

1

I found this problem when doing server-testing use postman. Actually this problem occur because you typing an error URL. Try fixing the URL that you hit. And it works for my problem

syaisyah
  • 11
  • 1
0

I found a solution :

  • install perl to create cgi script
  • define the following rules in the httpd.conf :

    AddHandler cgi-script .pl
    RewriteCond %{REQUEST_URI} ^/my/url
    RewriteCond %{REQUEST_METHOD} PUT
    RewriteRule /my/url "C:/Apache/Apache2.2/cgi-bin/myurlput.pl"

and it's worked

asicfr
  • 1,061
  • 1
  • 13
  • 30
  • Does this mean that there is not way for Apache to handle a PUT file request without an additional script ? – M-Jack Oct 22 '21 at 12:16