【发布时间】:2014-04-03 01:11:25
【问题描述】:
我设置了存储桶策略,因此只有从某个网站推荐的用户才能访问我的 Amazon S3 存储中的某个 PDF 文件。
文件设置为私有,存储桶策略似乎运行良好,除了 Chrome 在打开 PDF 文件时卡在加载页面上。不过,我可以通过右键单击链接并保存来下载 PDF。
它也适用于 IE,但在 Safari 和 Firefox 中运行良好。我尝试清除缓存,但没有帮助。
这是我使用的存储桶策略:
{
"Version": "2012-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests originated from www.example.com and example.com",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::examplebucket/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"http://example.com/*",
"http://www.example.com/*"
]
}
}
}
]
}
谢谢
【问题讨论】:
-
怀疑 CORS 问题。检查此线程是否有帮助:stackoverflow.com/questions/20253472/…