incorrect content-length with proxy

Dusty Doris nginx at dusty.name
Sat Dec 12 23:20:24 MSK 2009


I am testing nginx as a replacement to apache for proxying to a
backend app server and serving up the static files.  We are using the
upstream module, with a basic configuration.  In our app, we handle
file uploads that can get quite large, up to a few G at times.  Right
now we are having an issue with a client that is sending us an
incorrect content-length in the header.

To help with the large file uploads, I've added this to my location param
  client_body_timeout 600;
  client_max_body_size 5g;
  client_body_buffer_size 128k;

Now, when we manually change the content-length to be the correct
size, it works.  Nginx gets the whole file or files and then sends
them over to the app server in one shot.  However, when the
content-length is incorrect, it seems that nginx is still waiting and
the backend never gets hit, and the client never receives a response.

Obviously we want the correct content-length, but I believe the
problems comes from the client compressing it on the fly and its
estimates of file sizes are inaccurate.  Anyone have any advice about
handling this?  If we can't get the correct content-length, is there a
way to make nginx ignore that and just accept whatever size comes
through?

Also, is it possible to have nginx stream the uploads to the app
server, instead of buffering them locally and then sending them over?
I do not necessarily think that is the best option, as it makes sense
to me to have it as fast as possible between the proxy and the
backend, but I was wondering if its an option.

Thanks for any advice.



More information about the nginx mailing list