It took me way too long to figure out how to get S3 cors headers working, here are my notes.
- In the S3 interface, click the magnifying glass icon to the left of your bucket.
- Click the “Edit CORS Configuration” button. It should be right next to “Add Bucket Policy”
- You should already have a CORS XML file in here, if not mine looked like this :
<?xml version="1.0" encoding="UTF-8"?>
- This CORS header allows all websites to perform GET requests against this resource.
- To reference the file, you must use the url structure
- If using an img tag, it must contain the attribute
crossorigin="anonymous". Read more here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-crossorigin
Check out MDN for more information about CORS headers.
Originally published at dashron.com.