问题
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:
- 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)
- 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