title: AWS S3 with Basic Auth with Lambda gives AccessDenied when refreshing the page
body: <p>I have setup S3 with CloudFront to serve static site behind Basic HTTP authentication, similar to this setup here: <a href="https://stackoverflow.com/questions/55874983/basic-user-authentication-for-static-site-using-aws-s3-bucket">Basic User Authentication for Static Site using AWS &amp; S3 Bucket</a></p>
  
  <p>Everything seems to work fine, but for some reason when I do a refresh of the site, CloudFront responds with <code>403 AccessDenied</code>. This is also happening only when navigating somewhere to the site, like <code>example.com/somepath</code> and refreshing the site. If I stay at the root level: <code>example.com</code> and hit that refresh button everything seems to work fine.</p>
  
  <p>I have configured routing on react app, so just to be clear that when navigating site via application links all seems to be normal. Only refreshing the page causes above issue. I have static website hosting disabled on S3 as I don't want anyone accessing my S3 files via S3 links directly.</p>
  
  <p>I have added a custom Error Page to the CloudFront distribution. For all 403 errors it should fetch root from origin <code>/</code> and return 200 HTTP status code.</p>
  
  <p>Any ideas where to look for the issue?</p>