我在S3上有一个自定义重定向规则:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals/>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<HostName>example2.com</HostName>
<ReplaceKeyPrefixWith>services/create?key=</ReplaceKeyPrefixWith>
<HttpRedirectCode>307</HttpRedirectCode>
</Redirect>
</RoutingRule>
</RoutingRules>
我的桶有适当的政策:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example.com/*"
}
]
}
当我通过其内部网址http://example.com.s3-website-us-east-1.amazonaws.com
访问它并且它正确地将我重定向到我的其他服务器时,这可以正常工作。
但是,它不适用于我的CloudFront设置。当我尝试直接访问它(http://example.com/images/dummy.jpg
)时,我收到 403 AccessDenied 。