Apache 模块 mod_allowmethods

Description:轻松限制可以在服务器上使用的 HTTP 方法
Status:Experimental
Module Identifier:allowmethods_module
Source File:mod_allowmethods.c
Compatibility:在 Apache 2.3 和更高版本中可用

Summary

通过此模块,可以轻松限制可以在服务器上使用的 HTTP 方法。最常见的配置是:

<Location "/">
   AllowMethods GET POST OPTIONS
</Location>

AllowMethods Directive

Description:限制对列出的 HTTP 方法的访问
Syntax:AllowMethods reset|HTTP-method [HTTP-method]...
Default:AllowMethods reset
Context:directory
Status:Experimental
Module:mod_allowmethods

HTTP 方法区分大小写,并且按照 RFC 的规定,通常采用大写形式。 GET 和 HEAD 方法被视为等效。 reset关键字可用于在更深层的嵌套上下文中关闭mod_allowmethods

<Location "/svn">
   AllowMethods reset
</Location>

Caution

该模块无法拒绝 TRACE 方法;请改用TraceEnable

编写mod_allowmethods是为了替换LimitLimitExcept的笨拙实现。