Search code examples
amazon-web-servicesamazon-s3amazon-cloudfront

Cloudfront 404 , NoSuchKey


I am encountering an issue where CloudFront is unable to see the path in my S3 bucket. When I try to access https://example.com/teeodor, I receive the following error message:

<Error>
  <Code>NoSuchKey</Code>
  <Message>The specified key does not exist.</Message>
  <Key>teeodor</Key>
</Error>

I have verified that the "teeodor" folder in my S3 bucket contains an index.html file. I have also tried changing the path to */, but it did not resolve the issue. But on path , https://example.com/teeodor/index.html , I get my file Any help or suggestions on resolving this issue would be greatly appreciated. Thank you.


Solution

  • CloudFront won't automatically add index.html to your request. If you want that behavior, you need to (1) enable website hosting on your S3 bucket, then (2) update your CloudFront origin to point to the website hosting endpoint rather than the S3 bucket endpoint

    https://docs.aws.amazon.com/AmazonS3/latest/userguide/EnableWebsiteHosting.html