ovh / public-cloud-roadmap

Agile roadmap for OVHcloud Public Cloud services. Discover the features our product teams are working on, comment and influence our backlog.
https://www.ovhcloud.com/en/public-cloud/
187 stars 5 forks source link

Swift CORS access on private object storage #95

Closed drzraf closed 1 year ago

drzraf commented 3 years ago

Note: The feature proposal has been proposed via OVH support... and closed. It apparently led to my account at community.ovh.com being held and posts being flagged/hidden. I'm sorry I can't reference here the original topic where the rationales and issues at pace were thoughtfully explained.

Problem: When the object storage is used from a browser, CORS restrictions apply... during the authentication (token gathering) phase : We can't fetch X-Subject-Token when calling /auth/tokens.

The reason this header is not available is that following header must be exposed:

Access-Control-Expose-Headers: X-Subject-Token

But the preflight does not return some Access-Control-Allow-Headers that would allow the browser to fetch this header's value and continue.

The good thing is that this is plainly configurable by OVH administrators in the OpenStack configuration: https://docs.openstack.org/keystone/pike/configuration/samples/keystone-conf.html The value of "expose_headers" in the [cors] section is here for this.

In case of Ansible deployment (https://docs.openstack.org/openstack-ansible-os_keystone/queens/), it's possible to use keystone_extra_headers.

Workarounds explored:

I hope this great feature (private use of containers from the browser) could be unlocked, the stack of the problem analyzed (and the fact that I got locked from community.ovh.com for suggesting it... be reconsidered [moderators can't be contacted]).

Thank you

SDAChess commented 3 years ago

I'm having the exact same issue with this. Hoping for a fix to work in the browser...

tex0l commented 2 years ago

I'm having this issue as well

GTorreil commented 2 years ago

We are having the same issue using the S3 API. Hoping for a fix to work in the browser as well.. This is a real deal breaker :(

rverchere commented 1 year ago

Hi,

I see this issue moved to "Released (Changelog). So is it implemented?

Does it also work on your "Standard Object Storage – S3 API" ?

CorentinStauder commented 1 year ago

I also need CORS compatibility for S3 object storage, any news? Has anyone managed to do this?

Izaia64 commented 1 year ago

It is working. We are working in a documentation to help users, it will be published soon.

acouette commented 1 year ago

hello @Izaia64 ,

Any update ?

Do you mean it is working for the "S3 API" as well or only the "Standard Object Storage" ?

CorentinStauder commented 1 year ago

Working for me with standard object storage, you need to set it up with the AWS CLI, something like : aws s3api put-bucket-cors --bucket my-bucket --cors-configuration cors.json and cors.json :

{
  "CORSRules": [
    {
    "AllowedHeaders": ["header1", "header2", ...etc],
    "AllowedMethods": ["GET", "HEAD", ...etc],
    "AllowedOrigins": ["https://<origin-domain>", ...etc],
    "ExposeHeaders": ["Access-Control-Allow-Origin"]
    }
  ]
}

I also had an error message saying cors not enabled but the "real" error was AWS sdk not signing with v4 signature by default.

Hope it will help 👍

acouette commented 1 year ago

Thank you @CorentinStauder, indeed it works smoothly with the aws s3 client for the s3 object storage.

lason-ovh commented 1 year ago

Hi, you can find the documentation here

drzraf commented 1 year ago

@lason-ovh : This is issue mustn't be closed because it does affect OpenStack Swift and that's the main purpose of this issue.