【发布时间】:2020-11-08 18:14:20
【问题描述】:
我正在尝试在 S3 上进行设置以防止盗链。
我从这里得到了建议:How do I prevent hotlinking on Amazon S3 without using signed URLs?
还有这个:https://kinsta.com/blog/hotlinking/
但是,我无法让它工作。
首先,我阻止对存储桶的所有公共访问,因此“权限”选项卡上的设置如下:
我设置了这样的政策:
{
"Version": "2008-10-17",
"Id": "HTTP referer policy example",
"Statement": [
{
"Sid": "prevent hotlinking",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::mybucket/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"http://example.co.uk/*",
"http://www.example.co.uk/*",
"https://example.co.uk/*",
"https://www.example.co.uk/*",
"http://localhost/01-example/*"
]
}
}
}
]
}
但是,当我尝试从引用站点访问存储桶中的内容时,我看不到 S3 内容。
我做错了什么?
【问题讨论】:
标签: amazon-web-services amazon-s3