2
这是我nginx的配置设置 -Nginx的:限速设置不工作
{
limit_req_zone $binary_remote_addr zone=main:10m rate=1r/s; # on top of conf file
...
location /login {
limit_req zone=main burst=3 nodelay;
ModSecurityEnabled on;
ModSecurityConfig /usr/local/nginx/conf/modsecurity.conf;
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
当击打使用下面的代码API URL(http://localhost:4000/login)多次 -
for i in {0..2000}; do (curl -Is http://localhost:4000/login | head -n1 &) 2>/dev/null; done
我总是得到200响应代码,而不是得到503应该被拒绝的一些请求。
请我解决这个问题。
与我相同,这方面的任何解决方案? – pahnin