1

I use route 53 as my dns serever then I have a A record in my route 53 records called image.mysite.com. A 111.222.333.444

then I want to use CloudFront as my cdn to caching images then I added new Distributions and removed the A record added cname:

image.mysite.com.    CNAME    d23456.cloudfront.net

but when I visit my website image.mysite.com it show

Sorry, invalid request

and when i trying to visit d23456.cloudfront.net directly it displayed:

ERROR

Failed to contact the origin.

how can I successfully use CloudFront as image.mysite.com CDN and use route 53 as dns server?

2
  • What DNS name did you add for the custom origin in CloudFront? Commented Mar 3, 2013 at 21:00
  • I type image.mysite.com in Cloudfront origin
    – jk jk
    Commented Mar 3, 2013 at 21:02

1 Answer 1

3

From your comment it seems that you point CloudFront to the origin server images.mysite.com which actually points back to CloudFront so CloudFront doesn't know how to access your site.

Create another DNS record (e.g. origin.mysite.com. IN A 111.222.333.444) and point CloudFront to it. After that CloudFront would respond to requests to images.mysite.com with data from origin.mysite.com.

9
  • do you mean add DNS record [origin.mysite.com. A 111.222.333.444] and [image.mysite.com. CNAME d23456.cloudfront.net] then turn CloudFront Origin to origin.mysite.com?but how cloudfront cache images in image.mysite.com?
    – jk jk
    Commented Mar 3, 2013 at 21:07
  • Yes. You can also use any already existing DNS name. It just can't be the same DNS name that you use point to CloudFront. Commented Mar 3, 2013 at 21:10
  • but I want CloudFront cache the images at server image.mysite.com
    – jk jk
    Commented Mar 3, 2013 at 21:14
  • The official DNS name for your site will still be image.mysite.com. origin.mysite.com would only be used by CloudFront itself. Otherwise CloudFront can't know where your origin server is because image.mysite.com points to Amazon servers and not yours. Commented Mar 3, 2013 at 21:19
  • also one more problem,if i type [image.mysite.com. A 111.222.333.444] then visit image.mysite.com will match the vhost in my server,does your method works fine?I mean can display the webpage successfully
    – jk jk
    Commented Mar 3, 2013 at 21:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.