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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南