I am trying to upload files through nginx proxy_pass to a nodejs server.
My location looks like this:
location /upload {
proxy_pass http://127.0.0.1:8080;
chunked_transfer_encoding on;
proxy_buffering off;
client_max_body_size 10M;
}
It works ok for files smaller than 64K, but for larger files, only the first 64K is received by the nodejs server. If I upload directly to the nodejs server it works as expected.
I get this error in the nginx error log:
2014/07/25 09:01:53 [error] 39397#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: localhost, request: "PUT /upload/henrik/test.jpg HTTP/1.1", upstream: "http://127.0.0.1:8080/upload/henrik/test.jpg", host: "localhost"
Though the client seems to think it goes well:
$ curl -I --upload-file testdata/test.jpg localhost:8080/upload/henrik/test.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Fri, 25 Jul 2014 07:04:11 GMT
Connection: keep-alive
Transfer-Encoding: chunked
100 2213k 0 0 100 2213k 0 21.9M --:--:-- --:--:-- --:--:-- 21.8M
My location looks like this:
location /upload {
proxy_pass http://127.0.0.1:8080;
chunked_transfer_encoding on;
proxy_buffering off;
client_max_body_size 10M;
}
It works ok for files smaller than 64K, but for larger files, only the first 64K is received by the nodejs server. If I upload directly to the nodejs server it works as expected.
I get this error in the nginx error log:
2014/07/25 09:01:53 [error] 39397#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: localhost, request: "PUT /upload/henrik/test.jpg HTTP/1.1", upstream: "http://127.0.0.1:8080/upload/henrik/test.jpg", host: "localhost"
Though the client seems to think it goes well:
$ curl -I --upload-file testdata/test.jpg localhost:8080/upload/henrik/test.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Fri, 25 Jul 2014 07:04:11 GMT
Connection: keep-alive
Transfer-Encoding: chunked
100 2213k 0 0 100 2213k 0 21.9M --:--:-- --:--:-- --:--:-- 21.8M