简体   繁体   中英

Amazon CloudFront setup with custom domain name

I have an application which serves assets under the following URL:

https://example.com/assets/...

Now I want to use Amazon CloudFront to serve these assets with the URL

https://cdn.example.com/assets/...

The things I have done:

  1. I created a new distribution with the origin of cdn.example.com
  2. I added a CNAME DNS record pointing cdn.example.com to example.com

Now I feel like that configuration does not serve the assets via CloudFront. Instead if I request my CloudFront Domain Name, lets say dpw02sdffky7p.cloudfront.net , I get redirected to example.com . So it feels like my assets are still being served from my server, just with some redirects in between.

Am I right? What would be the correct configuration to achieve my goal?

while creating cname record in route53, Alias should be given as yes for endpoints like cloudfront, it will resolve the redirection in server side itself.

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html

https://serverfault.com/questions/419402/similarities-and-differences-between-cname-record-and-route-53-alias-record

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM