Ask Your Question
1

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

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

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

Comments

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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

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

eswenson gravatar image

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

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="xxx.example.com"/> `

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: https://xxx.example.com"

swift post xxxx --meta "X-Container-Meta-Access-Control-Allow-Origin: https://xxx.example.com"

swift post xxxx --meta "Access-Control-Allow-Origin: https://xxx.example.com"

swift post xxxx --meta "Access-Control-Allow-Headers: https://xxx.example.com"

swift post xxxx --meta "Access-Control-Expose-Headers: https://xxx.example.com" `

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

Comments

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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

2 followers

Stats

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

Seen: 751 times

Last updated: Jun 27 '16