Setting an open CORS policy on an S3 bucket
posted 2022.01.18 by Clark Wilkins, Simplexable
I was working on implementing file uploads to S3 in a React project. One of the setup steps is to implement a cross-border CORS configuration. Here's how you get this done.
- Login to your S3 console.
- Go to the bucket.
- Select permissions.
- Scroll down to Cross-origin resource sharing (CORS).
- Click Edit and add this JSON array.
[ {
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"HEAD", "PUT",
"POST"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]
There's a good explanation of this here.