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).
Code language: CSS (css)

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

isogroup-cover
Join The IsoGroup
A vibrant Facebook Group to talk about web design and the business of agency. Daily curated resources and conversations.
oxygen-course-isotropic
Oxygen Builder Course - Coming Soon
The Oxygen Builder Mastery course will bring you from beginner to professional - ACF, MetaBox & WooCommerce modules included.
Get Launch Notification & Discount
bricks-builder-course
Bricks Builder Course - Coming Soon
The Bricks Builder Mastery course will bring you up to speed on this popular builder.
Get Launch Notification & Discount
Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
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.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram