[英]Angular application hosted on AWS redirection gives access denied having cloudfront ahead of S3
[英]AWS S3 Angular Access Denied
我正在尝试获取我的 S3 存储桶中的文件并尝试下载它们,但是当我单击它们时,它会打开一个包含此错误的页面
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>FE17C7B6E365BAD4</RequestId>
<HostId>ujchseKLaqfZmxSim8WnC8oNLH/59KyE6JJUKZ1UFp7daOq/OnlAAjY1nkw2ZYDWlokZN4R17g0=</HostId>
</Error>
控制台显示加载资源失败:服务器响应状态为 403(禁止)
这是我用来获取文档的代码
getFiles(): Observable<Array<FileUpload>> {
const fileUploads = new Array<FileUpload>();
const params = {
Bucket: this.BUCKET,
};
this.getS3Bucket().listObjects(params, function (err, data) {
if (err) {
console.log('There was an error getting your files: ' + err);
return;
}
console.log('Successfully get files.', data);
const fileDatas = data.Contents;
fileDatas.forEach(function (file) {
fileUploads.push(new FileUpload(file.Key, 'https://xtec123.s3-us-west-2.amazonaws.com' + '/' + file.Key));
});
});
return of(fileUploads);
}
访问完全设置为公开,没有任何限制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.