nginx文件上传与proxy_pass流 [英] nginx files upload streaming with proxy_pass

查看:1195
本文介绍了nginx文件上传与proxy_pass流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将nginx配置为我的node.js应用程序的反向代理,用于使用proxy_pass指令进行文件上传。
它的工作原理,但我的问题是,nginx等待整个文件正文上传之前传递给上游。这对我造成问题,因为我想跟踪我的应用程序的上传进度。任何想法如何配置nginx为了流文件正文实时到上游?

I configured nginx as reverse proxy to my node.js application for file uploads with proxy_pass directive. It works, but my problem is that nginx waits for the whole file body to be uploaded before passing it to the upstream. This causes problems for me, because I want to track upload progress at my application. Any idea how to configure nginx in order to stream file body in real time to the upstream?

推荐答案

有没有办法(至少到目前为止)。在nginx开始发送到上游之前,完整请求将被缓存。要跟踪上传的文件,您可以尝试上传进度模块。

There is no way to (at least as of now). Full request will be always buffered before nginx will start sending it to an upstream. To track uploaded files you may try upload progress module.

更新:在nginx 1.7.11中, proxy_request_buffering 指令可用,它允许禁用请求主体的缓冲。它应该小心使用,请参阅文档。

Update: in nginx 1.7.11 the proxy_request_buffering directive is available, which allows to disable buffering of a request body. It should be used with care though, see docs.

这篇关于nginx文件上传与proxy_pass流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆