Reputation: 2174
I have run in to a problem while setting up my CloudFront.
What I want to do is to create a CDN for my images only that are hosted on my own server rather than S3 bucket. So the directory on the server with all the images is at mysite.org/images/
which if accessed directly without the file name should kick 404 error instead of 403. Now the way I need it to be set up is, for example someone accessing a page on my site misite.org/wedding/georgetown.html
or misite.org/wedding/london.html
all images that are served on those pages should come from location cdn.mysite.org/wedding/images/
, which if accessed directly without the file name should serve 403 error.
So what I have done so far that pretty much did not get me anywhere is, I set up cloudfront distribution that points to my origin server mysite.org
, but now the entire site is accessible via cdn.mysite.org
and mysite.org
, which is not really what I was trying to achieve.
Any help or suggestions please
Thanks in advance
Upvotes: 0
Views: 309
Reputation: 13025
Here is what you need to do,
Create multiple origins,
In the Behaviour enter pattern to,
map, /images/*
to cdn.mysite.org/wedding/images/
for your static resources
while rest of them come from different origin.
Hope it helps.
Upvotes: 1