Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Limit connections to location by ip with limit_conn

$
0
0
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?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>