在通过 nginx 上传的文件上添加的请求标头

时间:2021-06-17 13:12:23

标签: linux nginx postman

我已按照 Nginx PHP Failing with Large File Uploads (Over 6 GB) 在 nginx 中启用文件上传。

当前的 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/;
    }

文件被上传,但是请求头被应用在文件的开头,例如:

----------------------------306210650889621245841197^M
Content-Disposition: form-data; name="file"; filename="foo.bar"^M
Content-Type: application/octet-stream^M
^M
...rest of the file...

我正在使用 Postman 测试上传,但是我认为在 nginx 处理文件时会应用请求标头。有没有办法删除这些标题?

0 个答案:

没有答案
相关问题