2

I've got an Nginx server configured as a reverse-proxy. I POST some data to it, and the upstream server determines that the data is invalid before I've sent it all up.

My upstream server responds with a 400 code, and error message, and closes the connection. Nginx seems to be unhappy that the connection's been aborted and it does not pass the response body back to my client. I see the following error from Nginx at 'info' level:

2015/08/25 15:28:49 [warn] 10#0: *103 a client request body is buffered to a temporary file /opt/nginx/var/client_body_temp/0000000002, client: 172.17.42.1, server: , request: "POST /upload HTTP/1.1", host: "localhost:8002"

2015/08/25 15:28:49 [error] 10#0: *103 readv() failed (104: Connection reset by peer) while reading upstream, client: 172.17.42.1, server: , request: "POST /whoopstrap HTTP/1.1", upstream: "http://172.17.1.250:80/upload", host: "localhost:8002"

172.17.42.1 - - [25/Aug/2015:15:28:49 +0000] "POST /upload HTTP/1.1" 400 25 "-" "curl/7.40.0”

If I talk to my upstream server directly with Curl, it warns me that the connection was closed before it could finish its upload, but it displays the response body from the server.

Can I get Nginx to pass along the response body? Do I need to accept the entire upload before responding?

1

1 Answer 1

1

You probably have figured this out, but I'll answer for posterity anyway. As suggested here, yes, it seems you do have to accept the entire upload in the upstream server (or "implement a proper connection teardown").

A similar question has also been answered on SO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.