I've followed Nginx PHP Failing with Large File Uploads (Over 6 GB) to enable file upload in nginx.
Current nginx.conf:
location /upload {
root /tmp;
client_body_temp_path /tmp/foo/;
client_body_in_file_only on;
client_body_buffer_size 128K;
client_max_body_size 50M;
proxy_pass_request_headers on;
proxy_set_header X-File-Name $request_body_file;
proxy_set_body off;
proxy_redirect off;
proxy_pass http://127.0.0.1:4000/;
}
Files get uploaded, however request headers get applied at the beginning of the file, for example:
----------------------------306210650889621245841197^M
Content-Disposition: form-data; name="file"; filename="foo.bar"^M
Content-Type: application/octet-stream^M
^M
...rest of the file...
I'm testing uploads using Postman, however I think request headers get applied when nginx processes the file. Is there a way to remove these headers?