Home page (index.html) working fine with cloudfront mapped url but when i go to any other page and refresh i get an error.
I tried with Bucket policy ::
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCloudFrontServicePrincipalReadOnly",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::mybucket/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::XXXXXXXXX:distribution/XXXXXXX"
}
}
}
]
}
But I get an error below when i access with cloudfront url. Note that i've disabled S3 public access so it cannot be accessed directly.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>6NYF5R63KS7PFW89</RequestId>
<HostId>
bfVPlbFcw8tSr0CnMIEyRiLeTw3CrAOc7d6v8xw1YGl0YoIr1yWO7tgTQDsqKI5NdU0D0t9a/EU=
</HostId>
</Error>