Skip to content

Instantly share code, notes, and snippets.

@lengarvey
Created March 5, 2013 23:17
Show Gist options
  • Save lengarvey/5095281 to your computer and use it in GitHub Desktop.
Save lengarvey/5095281 to your computer and use it in GitHub Desktop.
Enabling Cross Origin Resource Sharing header in AWS for serving fonts through CloudFront.
# Log into the AWS console
# Select S3, and check out the properties on the bucket you want to change
# Expand permissions and click "Edit CORS Configuration"
# paste the thing below, edit in the AllowedOrigin things to be your url/s and you should be done
# make sure that you set this up before hitting your CloudFront distribution because caching will fuck you :(
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>
http://development.airtasker.com
</AllowedOrigin>
<AllowedOrigin>https://www.yoursite.com</AllowedOrigin>
<AllowedOrigin>https://yoursite.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment