Welcome! Log In Create A New Profile

Advanced

Nginx and HttpLimitZoneModule : how to send back a 503 error code for the client's requests except the first?

Posted by mika34 
I actually work on a web application in which the user must enter parameters in a form, and after form validation a binary is called by PHP script and processes an operation during a few seconds.

In order to avoid multiple form validations (and many long operations due to the binary process) i followed these instructions http://wiki.nginx.org/NginxHttpLimitZoneModule and i put these rules in the nginx configuration file of my site :

limit_conn_zone $binary_remote_addr zone=one:10m;

server {
#...

location / {
limit_conn one 1;
#...
}
}
The problem is that according to the nginx tutorial mentionned above the second connection should send back to client a 503 http error code. but in facts when looking at my logs it appears that all the first connexions return a 499 error http code (request closed by the client), and only the last one is treated and returns a 200 http code. But the binary is executed for all the requests...

So the question is : how to only accept the first request and send back 503 error codes for all the following requests during execution of the first request, instead of stopping each request and send 499 error code as soon as a new request is sent by the client ?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
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