large file upload via Zuul

青春壹個敷衍的年華 提交于 2019-12-13 04:54:26

问题


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

Basically I have the applications set up like this:

  • UI: this is where the Zuul Gateway is located
  • Backend: this is where the file must finally arrive.

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 ?


回答1:


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

  1. By using "Transfer-Encoding: chunked" in header (but this cannot be used in a browser, as mentioned in the initial question, because this header is considered unsafe)
  2. By bypassing the DispatcherServlet servlet used by zuul (using the /zuul path in front of the usual path that I was using).

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.



来源:https://stackoverflow.com/questions/53260009/large-file-upload-via-zuul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!