isotropic-2022
Share
Blog
Search
Menu

Fix AWS' S3 Access-Control-Allow-Origin Header Error

By James LePage
 on January 29, 2021
Last modified on January 6th, 2022

Fix AWS' S3 Access-Control-Allow-Origin Header Error

By James LePage
 on January 29, 2021
Last modified on January 6th, 2022

If you're trying to publicly distribute files from an Amazon S3 bucket, you may have come across this error in the past:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at your-s3-bucket.com. (Reason: CORS request did not succeed).

In the new (2020) S3 interface/dashboard, you need to write the header as a JSON. This code will fix the S3 Access-Control-Allow-Origin Header, allowing for GET requests from any domain.

[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "HEAD" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]

This code is placed in the Cross-origin resource sharing (CORS) section of the permissions tab for your specific bucket.

On the dashboard, it would look like this:

How to fix the annoying "aws cors header ‘access-control-allow-origin’ missing"

Further reading: https://stackoverflow.com/questions/17533888/s3-access-control-allow-origin-header

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic Design, a digital agency that builds WordPress websites. I read, write and design constantly!
We're looking for new authors. Explore Isotropic Jobs.
Close
🇺🇸 English
Save posts, access exclusive content, join members-only communities and more.
Dark Mode Toggle
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram