Rafał Sobota
Rafał Sobota

Reputation: 1468

AWS: Cloudfront and EC2 on single domain

Is it possible to host mysite.com/ from ec2 and mysite.com/logo.gif from cloudfront?

Upvotes: 0

Views: 1947

Answers (3)

Skyler Johnson
Skyler Johnson

Reputation: 3873

To agree with David (above), you can set up a DNS CNAME for your CloudFront distribution, but the best you could do would be a subdomain of your site. It's a better way to do things anyway, if you follow Yahoo! or Google website performance guidelines.

  • developer.yahoo.com/performance/rules.html
  • code.google.com/speed/page-speed/docs/rules_intro.html

Upvotes: 0

David German
David German

Reputation: 1854

No, you won't be able to make the part of the URL after the domain name influence the DNS lookup for mysite.com. However, if you're willing to settle for something like "images.mysite.com/logo.gif", you can easily resolve images.mysite.com to your CloudFront distribution using a CNAME.

You could also configure the web server on your EC2 instance to redirect or proxy to CloudFront - but then your server is still getting hit every time that resource is loaded, which eliminates most of the benefit to using a CDN in the first place.

Upvotes: 5

takinbo
takinbo

Reputation: 125

In a way, you can. You would need to use a reverse proxy on your web server at mysite.com.

http://en.wikipedia.org/wiki/Reverse_proxy

Upvotes: 2

Related Questions