Object Storage Cors policy not working?

Hi, I have a bucket that I have set the cors policy to accept all origins.

When I try and run a fetch from javascript ( localhost ) I get an error

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

I have looked over every doc / stackoverflow question / response I can find but nothing seems to work, it always comes back with that same message?

Is there anything I'm missing here?

1 Reply

I’d suggest checking the CORS configuration on the bucket.

The best way I’ve found is to install and configure s3cmd and then use the “info” sub-command to check the CORS policy that is applied.

s3cmd info s3://your-bucket-name

s3://your-bucket-name/ (bucket):                                                                
   Location:  default                                                                        
   Payer:     BucketOwner                                                                    
   Expiration Rule: none                                                                     
   Policy:    none                                                                           
   CORS:      b'<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><CORSRule><AllowedMethod>GET</AllowedMethod><AllowedMethod>PUT</AllowedMethod><AllowedMethod>DELETE</AllowedMethod><AllowedMethod>HEAD</AllowedMethod><AllowedMethod>POST</AllowedMethod><AllowedOrigin>*</AllowedOrigin><AllowedHeader>*</AllowedHeader></CORSRule></CORSConfiguration>'        
   ACL:       xxxxx: FULL_CONTROL

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct