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 enable the handling of all HTTP methods as defined in RFC 2616 on Apache web server ? These would be:

OPTIONS
GET
HEAD
POST
PUT
DELETE
TRACE
CONNECT

I am using the Apache HTTP Server, version 2.2.22 (Ubuntu)
Here is my .htaccess File:

<Location /output>
        Dav On
    <LimitExcept GET HEAD OPTIONS PUT>
        Allow from all
    </LimitExcept>
</Location>

Here is the output I get from running Telnet – There is no PUT method:

Escape character is '^]'.
OPTIONS / HTTP/1.0

HTTP/1.1 200 OK
Date: Tue, 09 Oct 2012 06:56:42 GMT
Server: Apache/2.2.22 (Ubuntu)
Allow: GET,HEAD,POST,OPTIONS
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html

Connection closed by foreign host.

Any thoughts on this?

share|improve this question

migrated from stackoverflow.com Oct 14 '12 at 11:56

This question came from our site for professional and enthusiast programmers.

    
what version of apache to you use? –  MaVRoSCy Oct 8 '12 at 13:12
    
Server version: Apache/2.2.22 (Ubuntu) –  MatandDie Oct 8 '12 at 13:16
    
You're limiting the methods on the /output location, but you're asking for OPTIONS on the / location. Method limits do not apply to parent locations, only to deeper locations. –  lanzz Oct 15 '12 at 8:14

4 Answers 4

Apache implements all relevant HTTP methods for static content (actual files served directly by Apache). For dynamic content (CGI scripts, mod_php, etc), Apache does not care what the HTTP method is (unless it is explicitly restricted with a <Limit> directive), and passes the request to the appropriate handler as it is. Your script needs to handle the specific method as intended, not Apache. Even non-standard methods are passed to dynamic handlers with no problem.

Tested with an invalid ASDFG / HTTP/1.1 request handled by a mod_php script. No complaint from Apache, received ASDFG in $_SERVER['REQUEST_METHOD'] in the handler script.

share|improve this answer
    
Thanks for your answer. I edited my .htaccess file to allow some http methods. I checked with OPTIONS / HTTP/1.0 over telnet. Allowed http methods never changed. This issue is not about apache maybe, but it is a still problem for me to enable all http method. –  MatandDie Oct 8 '12 at 14:54
    
You should probably post exactly what you're trying, what response you are expecting to see, what you see instead, and how you handle those requests on the server side. Nothing should be stopping an OPTIONS request, unless you explicly forbid it with <Limit OPTIONS> deny from all </Limit> or a similar access control. –  lanzz Oct 8 '12 at 15:08
    
Thank you i added some output info –  MatandDie Oct 9 '12 at 6:58

based on http://httpd.apache.org/docs/current/mod/core.html , these methods can be modified in the directory and .htaccess configuration files using the Limit method [method] ... > ... </Limit> directive

Basically you have to comment out options like the ones below which are used to block the methods.

<Limit POST PUT DELETE>
  Require valid-user
</Limit>
share|improve this answer

Probably you're using libapache2-mod-php5filter instead of libapache2-mod-php5.

Details: apache2 and php5: module or filter

share|improve this answer

PHP Document has a references section for this http://php.net/manual/en/features.file-upload.put-method.php

The apache core documentation for the directive is at http://httpd.apache.org/docs/2.2/mod/mod_actions.html

share|improve this answer

Your Answer

 
discard

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