Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 and Cross-Origin Resource Sharing (CORS)

Tags:

Does Amazon S3 allow custom headers? Or am I out of luck?

Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS Access-Control-Allow-Headers: X-SOMETHING Access-Control-Max-Age: 1728000 

Example

var request = new XMLHttpRequest(); var url = 'http://example.s3.amazonaws.com/templates/welcome.html';  function callOtherDomain(){      request.open('GET', url, true);     request.withCredentials = "true";     request.onreadystatechange = handler;     request.send();  } 
like image 988
Baggz Avatar asked Jan 17 '11 19:01

Baggz


People also ask

What is S3 cross-origin resource sharing?

Cross-origin resource sharing (CORS) defines a way for client web applications that are loaded in one domain to interact with resources in a different domain. With CORS support, you can build rich client-side web applications with Amazon S3 and selectively allow cross-origin access to your Amazon S3 resources.

What does cross-origin resource sharing CORS enable?

Cross-Origin Resource Sharing (CORS) is a protocol that enables scripts running on a browser client to interact with resources from a different origin.


1 Answers

CORS is now officially supported on S3: http://docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html

like image 177
user686782 Avatar answered Oct 03 '22 10:10

user686782