Ask Your Question

How do you set Access-Control-Allow-Credentials CORS header

asked 2015-03-16 20:09:34 -0500

eswenson gravatar image

I see that SWIFT supports Access-Control-Allow-Origin and Access-Control-Allow-Headers, but how do you get it to send Access-Control-Allow-Credentials headers? Chrome preflight requests are failing to allow POSTs to SWIFT containers (with a policy) because ORIGIN pre-flight requests don't return an Access-Control-Allow-Credentials header.

How can I make SWIFT do this, when the ORIGIN request is on the container to which the user wants to upload?

edit retag flag offensive close merge delete


Hi, did you manage to resolve this issue. I have similar issues with CORS also...tnx

SyCode7 gravatar imageSyCode7 ( 2016-06-23 07:36:01 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-27 11:11:08 -0500

eswenson gravatar image

updated 2016-06-27 11:11:40 -0500

Hi SyCode7, I did manage to get around the issues, but it was so long ago and I haven't looked at our on-prem swift deployment in so longer that I've forgotten the details. Here is what I have in my notes that I added to /etc/swift/proxy-server.conf:

` [filter:crossdomain]

use = egg:swift#crossdomain

cross_domain_policy = <allow-access-from domain=""/> `

However, I do remember making some other changes to the actual buckets I needed to be able to access -- I think I did the following:

`swift post xxxx --meta "Access-Control-Allow-Credentials:"

swift post xxxx --meta "X-Container-Meta-Access-Control-Allow-Origin:"

swift post xxxx --meta "Access-Control-Allow-Origin:"

swift post xxxx --meta "Access-Control-Allow-Headers:"

swift post xxxx --meta "Access-Control-Expose-Headers:" `

What I don't remember is whether I had to patch any of the swift code. I'm sorry it's been too long since I worked on this. -- Eric

edit flag offensive delete link more


Hi Eswenson, thanks for your response. I also resolved by following the instructions given here. The approach you described above didn't work for me i.e. specifying the information in the swift.conf file. many thanks though :)

SyCode7 gravatar imageSyCode7 ( 2016-07-02 18:05:45 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2015-03-16 20:09:34 -0500

Seen: 870 times

Last updated: Jun 27 '16