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

查看:83
本文介绍了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天全站免登陆