简体   繁体   中英

Amazon S3 and Cross-Origin Resource Sharing (CORS)

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();

}

CORS现在在S3上得到官方支持: http//docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html

Currently, there is limited number of standrd http headers supported by s3.

\n

Access-Control-Allow-* headers are not supported at this time: https://forums.aws.amazon.com/thread.jspa?threadID=34281&tstart=0

UPDATE:

Support for Cross-Origin Resource Sharing is added: https://forums.aws.amazon.com/ann.jspa?annID=1620

S3 Browser Freeware also supports this feature: http://s3browser.com/s3-bucket-cors-configuration.php

可以在此处找到支持的HTTP标头列表: http//docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectPUT.html

今天,亚马逊宣布完全支持CORS,因此您现在可以使用HTML5将拖放文件直接用于Amazon S3。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM