Skip to content
大刘 大刘 发布于 2019年02月25日
一个 web 开发者

如何禁用 HTTP 的 DELETE PUT TRACE 方法

  1. Apache 在 httpd.conf 添加如下配置:
apache
<Location "/">
   AllowMethods GET POST
</Location>

参考:Apache AllowMethods 模块

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

基于 MIT 许可发布