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
asked 2 years ago1351 views
1 Answer
1

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
answered a year 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