nginx禁用除POST,GET以外的请求方式
1、修改 nginx 配置
在 nginx 配置文件中,增加如下配置内容:
if ($request_method !~* GET|POST|HEAD) {
return 403;
}
二 如果只禁用某个请求的PUT,OPTION等其他请求方式,配置如下:
location /api {
if ($request_method = 'OPTIONS') {
return 403;
}
proxy_cookie_domain ~\.?duck.com $host;
proxy_pass https://duck.com;
}