Case:
I have a few S3 buckets that store my media files. I wanted to map all these s3 buckets to a single CF distribution. (their files should be accessed from different paths).
I have made a CF distribution and added 2 buckets. For the behaviour, the first bucket is on Default(*) and the second bucket is on path nature/*.
Issues:
- I am able to access the primary bucket (one with default behaviour) but not able to access the secondary bucket (with path nature/*). The error on accessing the secondary bucket is "Access Denied".
Additional details:
- Both my buckets are not available to global access and CF is accessing them from OAI.
References:
-
CodePudding user response:
Your files in the second bucket must start with a top level prefix
nature/
or else the won't resolve. CF doesn't remove the path matched when routing, it is still there. If you can't move the objects in the second bucket into anature/
prefix, then you need a CF Function to remove this part of the path from the object key before forwarding the request to the S3 origin.