Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon CloudFront CNAME [closed]

I am setting up Amazon CloudFront to distribute the contents of an S3 bucket and it works fine when I use the xxxxxxx.cloudfront.net Amazon gives me.

However, I want to use static.mydomain.com to access my files. I have followed Amazon's instructions and have added a CNAME record from static.mydomain.com to xxxxxx.cloudfront.net and I have also specified that CNAME (static.mydomain.com) in my CloudFront distribution properties.

Still, I can't access my files from static.mydomain.com.

I am with MediaTemple and static.mydomain.com only serves me the default MediaTemple server page. When I request static.mydomain.com/myfile.css it gives me 'Sorry, invalid request'.

Any idea?

like image 377
Jonathan Roy Avatar asked Mar 13 '12 02:03

Jonathan Roy


People also ask

What is CNAME in CloudFront?

In CloudFront, an alternate domain name, also known as a CNAME, lets you use your own domain name (for example, www.example.com) in your files' URLs instead of using the domain name that CloudFront assigns to your distribution.

How do I resolve the Cnamealreadyexists error when I set up a CNAME alias for my CloudFront distribution?

Replace YourDistributionID with the ID of your distribution. Replace YourCNAME with the conflicting CNAME alias. Note: To verify ownership, you must have read access to YourDistributionID. You must also have an SSL certificate associated with the CloudFront distribution that secures the conflicting CNAME.


1 Answers

you need to add your domain static.mydomain.com into "Alternate Domain Names(CNAMEs)" also make sure your files have read access to anyone, in other words, your files are public.

like image 122
Paul Ma Avatar answered Sep 20 '22 16:09

Paul Ma