s3 bucket loads content, cloudfront shows not found then loads content Gatsby project

0

I have a gatsby project, I'm hosting the static content on S3 + cloudfont + route53
my S3 loads the content properly of any post or page bucket example http://londonfilmpremieres.com.s3-website.eu-west-2.amazonaws.com/matilda/.

but my cloudfront which is what I'm pointing to my domain always loads not found and then loads the content https://d1h745biu42n4w.cloudfront.net/matilda/

did I miss some permissions?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "S3BucketAccess",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:PutObject",
                "s3:GetObjectAcl",
                "s3:GetObject",
                "s3:DeleteObjectVersion",
                "s3:GetObjectVersionAcl",
                "s3:ListBucket",
                "s3:DeleteObject",
                "s3:PutObjectAcl",
                "s3:GetObjectVersion"
            ],
            "Resource": [
                "arn:aws:s3:::BUCKET_NAME/*",
                "arn:aws:s3:::BUCKET_NAME"
            ]
        }
    ]
}

or I need to do something else on my cloudfront I'm not really sure where the problem is .. or where to find it thanks in advance

已提问 2 年前313 查看次数
1 回答
0

I believe this is because react is looking for that directory in your S3 bucket. Try to create a custom error response in CloudFront for 404 error similar to this:

CloudFront Custom Error Response

profile picture
joahna
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则