通过Zuul上传大文件 [英] large file upload via Zuul

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

问题描述

我正在尝试通过Zuul上传大文件.

I'm trying to upload a large file through Zuul.

基本上,我的应用程序是这样设置的:

Basically I have the applications set up like this:

  • 用户界面:这是Zuul网关所在的位置
  • 后端:这是文件最终必须到达的位置.

我使用了此处所述的功能,因此如果我使用"Transfer-Encoding:chunked",则一切正常.但是,只能通过卷曲进行设置.我还没有找到在浏览器中设置此标头的任何方法(标头在控制台"拒绝设置不安全标头.. "中被错误消息拒绝.

I used the functionality described here so everything works fine if I used "Transfer-Encoding: chunked". However, this can only be set via curl. I haven't found any way to set this header in the browser (the header is rejected with the error message in the console "Refused to set unsafe header ..".

有什么主意如何指示标题设置此标题?

Any idea how to instruct the header to set this header ?

推荐答案

似乎实际上有两种通过zuul上传大文件的可能方法:

It seems that actually there are 2 possible ways to upload large files via zuul:

  1. 通过在标头中使用"Transfer-Encoding:chunked"(但如最初的问题所述,不能在浏览器中使用,因为此标头被认为是不安全的)
  2. 绕过zuul使用的DispatcherServlet servlet(在我使用的常规路径前面使用/zuul路径).

我发现在这方面的文档不是很清楚(可以使用两个选项中的任何一个).就我而言,考虑到文件是通过Angular Js(因此在浏览器中)上传的,我不得不使用第二种方法.

I found the documentation not very clear in this aspect (that you can use either of the 2 options). In my case, considering that the file was being uploaded via Angular Js (hence in the browser), I had to use the second approach.

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

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