的Safari 9.1.2访问控制检查中的Safari S3直接上传
试图通过使用节点AWS-SDK签名的请求PDF文件上传到S3时,我有一个问题。这种情况会间歇性地发生,谷歌搜索会说这是一个CORS问题,但它在90%的时间内运行良好!拉我的听到了!
我没有注意到Firefox这个问题发生,如果文件超过500Kb。我修正了这个问题,但我仍然在Safari上遇到这个问题。
客户:
// https://gist.github.com/guumaster/9f18204aca2bd6c71a24
$.ajax({
type: 'PUT',
url: signedRequest,
// Content type must much with the parameter you signed your URL with
contentType: file.type,
// this flag is important, if not set, it will try to send data as a form
processData: false,
// the actual file is sent raw
data: file,
success: function (data, textStatus, request) {
addToSupportingDocsURLDO(annexureFilename, reference, url, callback);
},
error: function (err, textStatus, request) {
_errorCallback('Could not upload file: ' + file.name + ' Please decrease the size of your file or try again later.');
// TODO: send [email protected] email with error
}
});
错误:
的XMLHttpRequest不能加载https://sofassets.s3-ap-southeast-2.amazonaws.com/597725898b90e600118f9c9d/599eb7843301240011281ecb/Annexure-D.pdf?AWSAccessKeyId=ACCESSKEYID&Content-Type=application%2Fpdf&Expires=1503574043&Signature=SIGNATURE&x-amz-acl=public-read由于访问控制检查。