问题原文
原帖链接 · senty · CC BY-SA 4.0
I have created an S3 and I uploaded files on the bucket successfully. Now, I am trying to make it work with CloudFront however it is giving me
IllegalLocationConstraintException
The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.
My S3 url is: http://my-bucket-name.s3.ap-east-1.amazonaws.com/assets/local/css/app.css (this returns me the file)
CloudFront is linked to the S3, and the url: https://id.cloudfront.net/assets/local/css/app.css (this returns me the IllegalLocationConstraintException)
In S3 bucket > Permissions >
"Block Public Access" is Off
"Bucket Policy" is auto-generated:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "######"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket-name/*"
}
]
}
What am I doing wrong?
已采纳解答
原帖链接 · senty · CC BY-SA 4.0
My issue was because my CloudFront origin was not in us-east, and when you auto-select your bucket's origin in CloudFront, it doesn't add the location prefix to the url. So make sure you add your s3 location like so:
bucketname.s3.ap-east-1.amazonaws.com
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
