I've deployed an Angular static website to Amazon S3 and used Cloudfront for it. When I'am accessing the default page myurl.com/
everything works fine and I can navigate through pages. But if I go to a certain page directly myurl.com/posts
for example I get an access denied with cloudfront. If I do it with the amazon s3 website endpoint I get a 404 response.
S3
Cloudfront
The documentation states that a 403 will be returned in CloudFront for a number of reasons. One of the resolutions is The requested objects must exist in the bucket.
.
As you're trying to access an object that does not exist CloudFront may be turning this into the 403 that you are receiving.
You should attempt accessing a key that does exist only, and configure your s3 endpoint to use an error document for times when the page does not exist.