![](/img/trans.png)
[英]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.