Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I am having trouble forcing S3 to set CORS headers on all of the objects it returns from a bucket, though CORS is enabled, as client-side S3 uploads are working, the returned objects do not have CORS headers!

The policy I have enabled is :

<?xml version="1.0" encoding="UTF-8"?>

<CORSConfiguration xmlns="">









Does anyone know what is wrong?

1 Answer

0 votes
by (44.4k points)

Make sure that you use an Origin header with every request. S3 will not send access-control headers if there is no Origin header is sent because S3 will consider them irrelevant. 

While loading images with the img tag, add crossorigin=”anonymous” attribute. 

In case of loading images with img, you need to add crossorigin="anonymous" attribute. See MDN Documentation on the cross-origin attribute. This will cause the browser to send an Origin request header as it does with XMLHTTPRequest.

You will have to change this





Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories