S3 – Access-Control-Allow-Origin Header

Usually, all you need to do is to “Add CORS Configuration” in your bucket properties.

amazon-screen-shot

The <CORSConfiguration> comes with some default values. That’s all I needed to solve your problem. Just click “Save” and try again to see if it worked. If it doesn’t, you could also try the code below (from alxrb answer) which seems to have worked for most of the people.

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
</CORSConfiguration> 

For further info, you can read this article on Editing Bucket Permission.

Leave a Comment