I created a Cloudfront distribution with a CNAME images.domain.com
with SSL, and I have 2 S3 buckets: one for user uploads, one for product pictures
The default bucket is the uploads bucket
I would like to use the same CloudFront for both buckets
So I added the 2 buckets as origins and created a "Behavior", with the path /products/*
using my product bucket as origin
My "Behaviors" are :
When I go to images.domain.com/products/78/34.jpg
I get an AccessDenied
The file "78/34.jpg" is present in my products bucket
Files from the other bucket are working fine (ie images.domain.com/upload67.jpg
with upload67.jpg in the uploads bucket)
The pattern /products/*
matches all objects in the specified origin bucket that are in a folder called 'products'. So, the key needs to be products/78/34.jpg
.
If you create a folder called 'products' inside the products bucket and move the 73/34.jpg file in to it, the images.domain.com/products/78/34.jpg
url should then work (you might need to invalidate if you recently got a error before creating the folder).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With