Receive AccessDenied when trying to refresh a page on my website - S3 and CloudFront

0

Hello,

For a while, I was simply storing the contents of my website in a s3 bucket and could access all pages via the full url just fine. I wanted to make my website more secure by adding an SSL so I created a CloudFront Distribution to point to my s3 bucket.

The site will load just fine, but if the user tries to refresh the page, they will receive an AccessDenied page.

I have a policy on my s3 bucket that restricts access to only the Origin Access Identity and index.html is set as my domain root object.

I am not understanding what I am missing.

Any help is much appreciated.

Maan
已提问 1 年前739 查看次数
1 回答
0

Try these steps to fix the issue:

  1. Ensure CloudFront's Origin Access Identity can access all files in your S3 bucket.
  2. Check all objects in S3 have the required permissions for CloudFront access.
  3. Redirect 404: Not Found errors to /index.html with a 200: OK response.
  4. Check CloudFront Origin Settings: Match the "Origin Protocol Policy" with your S3 setup.
  5. Check Viewer Protocol Policy: Set to "Redirect HTTP to HTTPS".
  6. Clear CloudFront cache after changes. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
AWS
Rumaisa
已回答 9 个月前

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

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

回答问题的准则