Access-Control-Expose-Headers: How to expose additional headers in spaces CDN?
In order to download files from DigitalOcean Spaces CDN using xhr, I need to add a following CORS header to OPTIONS/GET responses:
Access-Control-Expose-Headers: ETag, Content-Range. If I don’t do that, I get a similar error in my google chrome console:
Refused to get unsafe header "etag" (see https://stackoverflow.com/questions/5822985/cross-domain-resource-sharing-get-refused-to-get-unsafe-header-etag-from-re).
Spaces CDN settings make it possible to allow additional request headers (
Access-Control-Allow-Headers), but there’s no option to expose additional headers (
Since I’m using CloudFlare for DNS management, I worked around this issue by deploying a web worker that adds
Access-Control-Expose-Headers: ETag, Content-Range to every response from spaces CDN but ideally this would be possible in spaces settings.
Has anybody run into this issue? Do you know if they have plans to add this setting?