Nginx wait if reached max_conns instead of 502

1

I reverse proxy to an app which use way too many ram so I limited it to 5 connection via max_conns in an upstream block.
But when 5 connection is reached 502 error is fired but that not what I want, it would be better if connection just wait his turn (connection arn't long).

So an example of what I want with max_conns=3:

conn1 connect and nginx proxy it
conn2 connect and nginx proxy it
conn3 connect and nginx proxy it
conn4 connect and nginx makes it wait
conn5 connect and nginx makes it wait
conn1 finish
conn4 is now proxied
conn3 finish
conn5 is now proxied
conn2 finish
conn4 finish
conn5 finish

Jorropo

Posted 2019-05-26T02:27:10.790

Reputation: 11

No answers