【发布时间】:2019-03-28 23:33:16
【问题描述】:
我正在使用 lambda 生成预签名签名以将文件上传到 S3 存储桶。当我将它与 Postman/CURL 一起使用时,lambda 返回的签名有效。但是,当我尝试从我的程序发出 PUT 请求时,它会将 localhost 附加到预签名的 URL。我在本地计算机上使用 IIS 作为 Web 服务器。 可能与 IIS 配置有关吗?还是我在代码或应用配置本身中做错了什么?
我的代码如下:
const xhr = new XMLHttpRequest();
xhr.open('PUT', preSignedURL);
xhr.onreadystatechange = () => {
if(xhr.readyState === 4){
if(xhr.status === 200){
alert('File Ready to n upload. xhr.status: ' + xhr.status + 'xhrstatustext:' +xhr.statusText);
}
else{
alert('Could not upload file.');
}
}
};
xhr.send(file);
【问题讨论】:
-
这个相关的答案可能会回答你的问题:stackoverflow.com/questions/22531114/…
标签: javascript jquery amazon-web-services amazon-s3