I read many answers to this question but for some reason neither of them works for me. I have static website served by S3 with static website feature enabled and index document set to index.html. And there is CloudFront distribution pointing to that static S3 website. In my bucket I have following files, each of them with public access:
- file1.html
- file2 (with Content-Type: text/html metadata)
- file3/index.html
I tried visiting following pages:
- https://example.com/file1.html => works
- https://example.com/file2 => 404
- https://example.com/file3 => 404
- https://example.com/file3/index.html => works
404 response returns this:
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>index.html</Key>
<RequestId>02KPT6454CMB1D5M0</RequestId>
<HostId>pxZgtslx4ddbSh645ZiYxlLWEg6xxGLjxlwZNO+JzjFb4eu1/kp4SYZoMFXZO7muXtZ/iJZ9g=</HostId>
</Error>
I am struggling with this for several hours and can't make it work. From what I read I should either upload (or rename through S3 console) file without extension and add Content-Type: text/html metadata to it or I should create folder named like a file without extension and put file named index.html inside. Neither of those options works.