Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Last active Nov 15, 2016
Embed
What would you like to do?
CORS policy on S3/CloudFront
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