AWS S3 now uses JSON for CORS configuration and cors.json
is minimal configuration for Rails 7 direct uploads.
Last active
April 7, 2023 16:25
-
-
Save basti/20504eeb701d1bf2b3676b45c454f4b8 to your computer and use it in GitHub Desktop.
AWS S3 CORS configuration for Rails ActiveStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"AllowedHeaders": [ | |
"*" | |
], | |
"AllowedMethods": [ | |
"PUT" | |
], | |
"AllowedOrigins": [ | |
"https://www.example.com" | |
], | |
"ExposeHeaders": [ | |
"Origin", | |
"Content-Type", | |
"Content-MD5", | |
"Content-Disposition" | |
], | |
"MaxAgeSeconds": 3600 | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>https://staging.example.com</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> | |
</CORSRule> | |
<CORSRule> | |
<AllowedOrigin>https://staging.example.com</AllowedOrigin> | |
<AllowedMethod>PUT</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Content-Type</AllowedHeader> | |
<AllowedHeader>Content-MD5</AllowedHeader> | |
</CORSRule> | |
</CORSConfiguration> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment