gpt4 book ai didi

amazon-web-services - CloudFront 上的 IllegalLocationConstraintException(对于 S3)

转载 作者:行者123 更新时间:2023-12-04 16:24:13 30 4
gpt4 key购买 nike

我已经创建了一个 S3 并成功在存储桶上上传了文件。现在,我正试图让它与 CloudFront 一起工作,但它给了我

IllegalLocationConstraintException

The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.


我的 S3 网址是: http://my-bucket-name.s3.ap-east-1.amazonaws.com/assets/local/css/app.css (这将文件返回给我)
CloudFront 链接到 S3,并且 url: https://id.cloudfront.net/assets/local/css/app.css (这会返回 IllegalLocationConstraintException)

在 S3 存储桶中 > 权限 >
“阻止公共(public)访问”已关闭
“桶策略”是自动生成的:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "######"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket-name/*"
}
]
}
我究竟做错了什么?

最佳答案

即使您在 CloudFront 中自动选择 S3 作为相关存储桶,您仍然需要手动放置您的位置以使其正常工作。

更新:

我的问题是因为我的 CloudFront 源不在 us-east 中,并且当您在 CloudFront 中自动选择存储桶的源时,它不会将位置前缀添加到 url。因此,请确保像这样添加您的 s3 位置:
bucketname.s3.ap-east-1.amazonaws.com

关于amazon-web-services - CloudFront 上的 IllegalLocationConstraintException(对于 S3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56993266/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com