我正在尝试使用 knox 和 node.js 在 S3 上上传文件:
var s3req = s3.putBuffer(buffer, fileName, {
'Access-Control-Allow-Origin': 'http://myurl.com',
'Content-Type': mimetype,
'Cache-Control': 'public, max-age=' + maxAge,
'x-amz-acl': 'public-read'
}, function (err, s3res) {
// do something
文件上传正常。但是,当使用 XHR 请求资源时,Access-Control-Allow-Origin
响应中没有标头,因此会失败。
不能在单个资源上设置此标头吗?我必须在整个桶上设置这个吗?