Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 如何允许aws s3 bucket内容仅公开服务于特定域?_Amazon S3_Amazon Web Services - Fatal编程技术网

Amazon s3 如何允许aws s3 bucket内容仅公开服务于特定域?

Amazon s3 如何允许aws s3 bucket内容仅公开服务于特定域?,amazon-s3,amazon-web-services,Amazon S3,Amazon Web Services,我正在使用aws s3存储我的网站图片和视频内容。s3中的文件链接直接输出到html/php 问题是其他一些网站链接了我的图片/视频,这大大增加了s3的流量使用,当然也增加了支付账单 我知道在某些情况下,人们使用referer头来禁止外部站点链接。但在这种情况下,图片/视频直接从s3输出,而不是我的域 有人能帮助实现这一点吗?谢谢。您可以使用Amazon bucket策略,如: { "Version": "2012-10-17", "Id": "http referer poli

我正在使用aws s3存储我的网站图片和视频内容。s3中的文件链接直接输出到html/php

问题是其他一些网站链接了我的图片/视频,这大大增加了s3的流量使用,当然也增加了支付账单

我知道在某些情况下,人们使用referer头来禁止外部站点链接。但在这种情况下,图片/视频直接从s3输出,而不是我的域


有人能帮助实现这一点吗?谢谢。

您可以使用Amazon bucket策略,如:

{
    "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://www.example.com/*",
                        "http://example.com/*"
                    ]
                }
            }
        }
    ]
}

详细说明见:

参见:非常感谢。那正是我想要的。我做了搜索,但没有得到这一个。请您添加更多的细节,完善它来回答确切的问题。干杯