javascript Amazon S3 和跨域资源共享 (CORS)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4717006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Amazon S3 and Cross-Origin Resource Sharing (CORS)
提问by Baggz
Does Amazon S3 allow custom headers? Or am I out of luck?
Amazon S3 是否允许自定义标头?还是我运气不好?
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();
}
回答by user686782
CORS is now officially supported on S3: http://docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html
S3 现在正式支持 CORS:http: //docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html
回答by S3 Browser Team
Currently, there is limited number of standrd http headers supported by s3.
目前,s3 支持的标准 http 标头数量有限。
Access-Control-Allow-* headers are not supported at this time: https://forums.aws.amazon.com/thread.jspa?threadID=34281&tstart=0
目前不支持 Access-Control-Allow-* 标头: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
添加了对跨域资源共享的支持:https: //forums.aws.amazon.com/ann.jspa?annID=1620
S3 Browser Freeware also supports this feature: http://s3browser.com/s3-bucket-cors-configuration.php
S3 浏览器免费软件也支持此功能:http: //s3browser.com/s3-bucket-cors-configuration.php
回答by Skyler Johnson
The list of supported HTTP headers can be found here: http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectPUT.html
可在此处找到支持的 HTTP 标头列表:http: //docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectPUT.html
回答by VAAA
Today Amazon announces the complete support for CORS, so you can now use HTML5 for example for Drag & Drop files directly to Amazon S3.
今天亚马逊宣布完全支持 CORS,因此您现在可以使用 HTML5 将文件直接拖放到 Amazon S3。

