admin管理员组文章数量:1180512
We have a web application that calls REST APIs which are behind an API Gateway. We use WSO2 APIM as the gateway. One of the APIs we call is a simple GET
that downloads a file and we would like to put a progress bar on the download but we can't get the Content-Length
header in the response.
The API in question is not actually implemented programmatically (most are, but not this one). We have an ordinary Apache HTTPD web server on an internal server, not accessible from outside, that just serves the file. We create an API definition in the gateway with a GET
endpoint and use the internal server as a back-end. Thus you can call it as an API from outside (and are required to authenticate in order to do so). If I make the call internally, directly to the back-end then there is a Content-Length
header on the response.
Since it needs to be an authenticated call, the application makes the call and downloads the file before showing it to the user. We want to put a progress bar up while this is happening. We can see how much we have downloaded so far, but we need the total size to put it in context.
I have edited the deployment.toml
for the gateway. In the [apim.cors]
section I added Content-Length
to the expose_headers
list. This now reads
expose_headers = ["Content-Disposition", "Content-Type", "Content-Language", "WWW-Authenticate", "Content-Length"]
When we make the call, we now see Content-Length
listed among the values of the Access-Control-Expose-Headers
header, but we still don't get a Content-Length
header itself
Question: How can we get the Content-Length
header on the response?
本文标签: Not Getting ContentLength Header for CORS Request via WSO2 APIM gatewayStack Overflow
版权声明:本文标题:Not Getting Content-Length Header for CORS Request via WSO2 APIM gateway - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738157435a2066435.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论