I have a static Gatsby website hosted on S3 + Cloudfront. The site is working fine with custom error responses with path set to /index.html for error code 403
But when I try to manually enter a specific page path exmaple.com/path1 in the browser tab and hit enter, it redirects me to the home example.com page.
Why is that? Is there any solution for this?
My s3 permission policy:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "AllowCloudFrontServicePrincipal",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example.com/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::111111111111:distribution/f6666666"
}
}
}
]
}