How to enable all HTTP methods in an Apache HTTP Server

apache-2.2http

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?

Best Answer

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.