Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Last active November 15, 2016 03:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlconnor/4def41892c1af7af17b8 to your computer and use it in GitHub Desktop.
Save mlconnor/4def41892c1af7af17b8 to your computer and use it in GitHub Desktop.
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