Last active
November 15, 2016 03:31
-
-
Save mlconnor/4def41892c1af7af17b8 to your computer and use it in GitHub Desktop.
CORS policy on S3/CloudFront
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
Here is how you can test | |
Create bucket, add this policy. | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicReadGetObject", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::YOUR_BUCKET_NAME_HERE/*" | |
} | |
] | |
} | |
The go to static website hosting and enable that. Then click on the CORS policy and use the default one. | |
curl -sI -H "Origin: example.com" -H "Access-Control-Request-Method: GET" http://test.cokezero.com.s3-website-us-east-1.amazonaws.com/img/bottle_bg.jpg | |
Here is a good arcticle | |
http://blog.errorception.com/2014/11/enabling-cors-on-amazon-cloudfront-with.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment