Welcome! Log In Create A New Profile

Advanced

Limit connections to location by ip with limit_conn

Posted by glagola 
Limit connections to location by ip with limit_conn
December 24, 2013 02:31PM
I want to limit connections count to location from same ip and if limit was reached - throw 503 http error to client. It seems that, it's possible to do with limit_conn as described in doc http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html.

But I've strange behaviour - nginx(v1.2.1) just waiting until client finish file downloading, and then send same file again for the pending request.

Here is my nginx config:

http {
limit_conn_zone $binary_remote_addr zone=addr:10m;
...
server {
...
location ~* "^/d/" {
limit_conn addr 1;
limit_rate 128k;
}
...
}
...
}
What I'm doing wrong? Is it possible to abort pending request with http error?



Edited 1 time(s). Last edit at 12/24/2013 02:33PM by glagola.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 253
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready