S3通过CloudFront重定向

发布于 2025-02-11 06:10:03 字数 1031 浏览 1 评论 0原文

我想通过CloudFront使用S3重定向。

存储策略

        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ######"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::mybucket/*"
        },

“

S3重定向URL可以使用。但是Cloudfront域行不通。 CloudFront Origin是正确的存储桶。问题是什么?顺便说一句,水桶是空的。

<ListBucketResult>
<Name>bucket name</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
</ListBucketResult>

我还尝试了重定向规则,

[
    {
        "Redirect": {
            "HostName": "my.app",
            "HttpRedirectCode": "301",
            "Protocol": "https"
        }
    }
]

我得到了相同的结果。

I want to use S3 redirect via CloudFront.

Bucket policy

        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ######"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::mybucket/*"
        },

enter image description here

The s3 redirect URL works. But the CloudFront domain does not work. The CloudFront origin is the correct bucket. What is the problem? By the way, the bucket is empty.

<ListBucketResult>
<Name>bucket name</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
</ListBucketResult>

I have also tried redirection rules

[
    {
        "Redirect": {
            "HostName": "my.app",
            "HttpRedirectCode": "301",
            "Protocol": "https"
        }
    }
]

I get the same result.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必你懂 2025-02-18 06:10:03

解决方案是使用S3重定向URL。

The solution is to use the s3 redirect URL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文