跳到主要内容

如何禁用 HTTP 的 DELETE PUT TRACE 方法

· 阅读需 1 分钟
大刘
一个 web 开发者
  1. Apache 在 httpd.conf 添加如下配置:
<Location "/">
AllowMethods GET POST
</Location>

参考:Apache AllowMethods 模块

  1. Nginx 在 nginx.conf 中进行如下设置:
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 403;
}