Error response body not sent if upload is incomplete
Valentin V. Bartenev
vbart at nginx.com
Fri Dec 29 20:54:17 UTC 2017
On Friday, 29 December 2017 23:23:07 MSK naktinis wrote:
> This happens using the ngx_http_uwsgi_module, but it seems this might be
> more generic (i.e. also affects at least upstream servers).
> Here's what happens:
> * I send a HTTP/1.1 POST request with a Content-Type: multipart/form-data;
> header and a ~600kb file
> * Nginx receives the first part of the request and passes it to a uwsgi
> * The uwsgi app determines that a 403 response along with a JSON body
> should be returned
> * Nginx sends the 403 response to the client, but only containing the
> headers (not the JSON body)
> However, if I do everything the same way, but the uploaded file is tiny
> (e.g. 1 byte), I do get the error response body as expected. Non-error
> responses also work fine.
> It seems that nginx for some reason decides to ignore the response body (but
> still sends the headers) if the payload hasn't finished uploading.
> This looks like an inconsistent behaviour (or even a bug), but correct me
> know if there is something I misunderstood.
> Please find curl outputs and links to other users complaining about a
> similar thing below.
What's in the error log?
The error log from one of your links suggests, that the problme in
uwsgi server, not in nginx:
2015/08/25 15:28:49 [error] 10#0: *103 readv() failed (104: Connection reset by peer) while reading upstream
wbr, Valentin V. Bartenev
More information about the nginx