On Wed, Feb 10, 2016 at 02:47:23PM +0000, Chris White wrote:
> Ideally I would like to return 429 Too Many Requests.
It's not suited at all. 4xx are reports of client cause. The client
cannot do anything to fix this issue. Here the cause is the server,
it must be a 5xx, and the only one that fits is 503 (which we already
use for that purpose).
Anyway, I wanted to be certain that you were conscious about the
impact of rejecting clients based on the queue length.
In the mean time you can already use the "queue" sample fetch to write
a rule in your backend, for example :
backend foo
tcp-request content reject if { queue ge 100 }
This will cause the connection to abort (useful in TCP), or do it using
"http-request" instead of "tcp-request content" and it will return a 403
(or the page that you provide for this, which can be configured with the
errorfile directive).
Also please have a look at the documentation regarding the "queue" function
above, there are some hints to do something a bit better like only reject
new users etc.
Willy