Why might a 413 not be flushed to the client immediately?
The problem is that most HTTP clients don't read the response until they've sent the entire request body. If you're dealing with webbrowsers you're probably out of luck here. The only server side configuration you can do is set keepalive_requests
to 0 (which disables persistent connections), which might make nginx close the connection after sending the 413 which should cause the client to stop sending the data. The client is likely to report a network error instead of 413 however.