By using AWS re:Post, you agree to the Terms of Use

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


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

but my cloudfront which is what I'm pointing to my domain always loads not found and then loads the content

did I miss some permissions?

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "S3BucketAccess",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
            "Resource": [

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

1 Answer

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
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions