Loading a multipage file form, Nginx "rides" and does not pass it to the handler

I am new to nginx but I am familiar with low level HTTP and apache. When I try to upload a multipart / form file, nginx writes part of the client request body to disk, but never ends and never passes it down / up the script tag.

My specific setup: I have nginx with / dyn redirected to localhost: 1337 where the node.js instance is listening. It works ... except for the file upload handler. Also in config is / debug which is redirected to localhost: 1338 which goes to a simple dump server.

I changed the error log handling to "info". It reports saving the client body to a file, and when I view it almost as I expected:

--boundary_.oOo._MjM5NzEwOTkxMzU2MjA0NjM5MTQxNDA3MjYwOA==
Content-Type: image/jpeg
Content-Disposition: form-data; name="file"; filename="dccde7b5-25aa-4bb2-96a6-81e9358f2252.jpg"

<binary data, ~89k>

      

The problem with this file is too short, only 81,920 bytes, when the file is 88,963 bytes, it should be 88,963 + the header above ... But that's literally only half of it. There are 2 files (roughly the same size) that come in, so I would expect the file to be around ~ 160k. What nginx does by reassigning the HTTP request level Content-length

, then passes that header to the script that it is and of course my script complains that it never finds --boundary_.oOo._MjM5NzEwOTkxMzU2MjA0NjM5MTQxNDA3MjYwOA==

When I make the same request to my debug service without nginx in the middle, it sends data correctly and http Content-length

is the appropriate 186943 bytes (both files are about 80k so it makes sense)

My default nginx config is different from what I mentioned here.

Edit: After some experimentation, all files in the client body directory are 81920 bytes

+3


source to share





All Articles