首页 文章

403通过CloudFront访问我的网站时禁止访问

提问于
浏览
0

我将CloudFront与S3-bucket结合使用 .

当我直接访问我的CloudFront-domain(d4 ... cloudfront.net)时,一切正常,我可以看到我的网站SSL证书 .

但是,当我访问我的网站网址时,我收到403 Forbidden-message(尝试检索自定义错误文档时发生错误) .

这是我得到的错误:
enter image description here

这是响应头:
enter image description here

到目前为止我尝试了什么:

  • 当我创建CloudFront分配时,我选择了"Origin Access Identity: Create a new Identity"和"Update Bucket Policy"

  • 我添加了一个自定义错误页面,它返回StatusCode 200和/index.html作为respone页面

我的S3存储桶不公开,因为我只希望我的CloudFront使用此策略访问S3-Bucket:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin 
                Access Identity ..."
           },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::www.../*"
        }
    ]
}

1 回答

相关问题