1
Nginx configs提供了完全新的Noob。我想基于IP限制HTTP请求:这里是我到目前为止:我需要让所有的GET,但是我需要限制PUT DELETE和POST到特定IP范围在Nginx中限制http请求
location/{
index app.php index.php index.html;
try_files $uri @rewriteapp;
limit_except GET {
allow all;
}
limit_except PUT DELETE POST {
allow <IP SUBNET 1>;
allow <IP SUBNET 2>;
deny all;
}
任何想法,我会出错吗?它甚至有可能吗?
如何将不允许的方法重定向到另一个'proxy_pass'? –
@ W.M。您可以使用if动词来重定向,如果($ request_method = POST){ return 301 https://example.com$request_uri; }' –
为了清楚起见,我刚刚遇到同样的问题,这限制了一切,但限制了GET。即将被允许在POST,PUT等上,但没有别的。一切都会被允许GET请求。 –