Quantcast

limit_conn with variables erroring with invalid number of connections

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

limit_conn with variables erroring with invalid number of connections

fengx
Here is the configuration:

http {
    limit_conn_zone $binary_remote_addr zone=limitapinoauth:16m;
    limit_conn_zone $remote_user zone=limitapi:32m;
   
    map $remote_user $limit_zone {
        default   limitapi;
        ''        limitapinoauth;
    }

    map $remote_user $limit_number {
        default   100;
        ''        200;
    }
}

server {
    limit_conn $limit_zone $limit_number;
}

When starting NGINX getting a fatal error though. Does limit_conn support
using variables?

error => invalid number of connections "$limit_number"

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273805,273805#msg-273805

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: limit_conn with variables erroring with invalid number of connections

Francis Daly
On Sun, Apr 23, 2017 at 09:14:20PM -0400, justink101 wrote:

Hi there,

> server {
>     limit_conn $limit_zone $limit_number;
> }
>
> When starting NGINX getting a fatal error though. Does limit_conn support
> using variables?
>
> error => invalid number of connections "$limit_number"

http://nginx.org/r/limit_conn

Generally, if a directive argument accepts variables, the documentation
will say that it does. Otherwise, it's probably a documentation bug.

In this case, the documentation does not say that it accepts variables,
and the error message indicates that it does not.

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...