Http Nginx按正文或查询中的参数限制请求?

Http Nginx按正文或查询中的参数限制请求?,http,nginx,proxy,limit,Http,Nginx,Proxy,Limit,我需要使用包含在正文或查询参数中的特定参数来限制(获取、发布)请求。如何为此配置NGINX 当前nginx配置: limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s; server { listen 8044; limit_req_log_level warn; location /route/{ limit_req zone=mylimit burst=1000;

我需要使用包含在正文或查询参数中的特定参数来限制(获取、发布)请求。如何为此配置NGINX

当前nginx配置:

limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
server {
    listen       8044;
    limit_req_log_level warn;
    location /route/{
       limit_req zone=mylimit burst=1000;
       proxy_pass https://the_Cool_server/;
 }}
例如-请求类似于:

http://localhost:8044/route/path1/path2?param1=param1VALUE_to_limit1¶m2VALUEAWESOME

我需要NGINX限制每秒使用param1值的请求。因此,具有相同param1的每个请求应限制为每秒10个


也许我应该使用openresty?

limit\u req参数可以在http服务器位置块中,因此传统上只能通过路径来限制请求,例如:

http://localhost:8044/route/path1/path2

但是,只有当访问者点击您的查询字符串键(param1)时,才可以将访问者ip映射到变量,然后在limit\u req指令中使用该var($do\u limit),如:

map $arg_ctl    $do_limit {
    "param1"    $binary_remote_addr;
    default     "";
}
limit_req_zone $do_limit zone=mylimit:10m rate=10r/s;
server {
    listen       8044;
    limit_req_log_level warn;
    location /route/{
       limit_req zone=mylimit burst=1000;
       proxy_pass https://the_Cool_server/;
 }}

limit_req参数可以在http服务器位置块中,因此传统上只能通过路径来限制请求,如:

http://localhost:8044/route/path1/path2

但是,只有当访问者点击您的查询字符串键(param1)时,才可以将访问者ip映射到变量,然后在limit\u req指令中使用该var($do\u limit),如:

map $arg_ctl    $do_limit {
    "param1"    $binary_remote_addr;
    default     "";
}
limit_req_zone $do_limit zone=mylimit:10m rate=10r/s;
server {
    listen       8044;
    limit_req_log_level warn;
    location /route/{
       limit_req zone=mylimit burst=1000;
       proxy_pass https://the_Cool_server/;
 }}

你想做什么的例子会很好你想做什么的例子会很好