问题
I used this document : http://docs.openstack.org/developer/swift/cors.html#test-cors-page
Used the below code, sends Option request and get 200 as the response. But the orginal method 'get' doesn't get response. And browser console says 'Access-Control-Allow-Origin' CORS header is not found.
$.ajax({
method: "GET",
url : url,
crossDomain: true,
headers: {
'X-Container-Meta-Access-Control-Allow-Origin' : 'http://127.0.0.1:8080',
'X-Container-Meta-Access-Control-Max-Age' : 10,
'X-Auth-Token' : token
},
contentType : 'application/json; charset=utf-8'
});
回答1:
If memory serves the SL Object Storage only support CORS on containers and not individual objects. The following headers should be supported:
X-Container-Meta-Access-Control-Allow-Origin
Origins to be allowed to make Cross Origin Requests, space separated.
X-Container-Meta-Access-Control-Max-Age
Max age for the Origin to hold the preflight results.
X-Container-Meta-Access-Control-Expose-Headers
Headers exposed to the user agent (e.g. browser) in the actual request response, space separated.
来源:https://stackoverflow.com/questions/36493793/softlayer-open-stack-swift-how-to-solve-cross-domain-origin-with-object-stora