[英]Amazon CloudFront setup with custom domain name
I have an application which serves assets under the following URL:我有一个应用程序,它在以下 URL 下提供资产:
https://example.com/assets/...
Now I want to use Amazon CloudFront to serve these assets with the URL现在我想使用 Amazon CloudFront 通过 URL 为这些资产提供服务
https://cdn.example.com/assets/...
The things I have done:我做过的事情:
cdn.example.com
cdn.example.com
的新发行cdn.example.com
CNAME
DNS record pointing cdn.example.com
to example.com
CNAME
DNS 记录,指向cdn.example.com
到example.com
Now I feel like that configuration does not serve the assets via CloudFront.现在我觉得该配置不能通过 CloudFront 为资产提供服务。 Instead if I request my CloudFront Domain Name, lets say
dpw02sdffky7p.cloudfront.net
, I get redirected to example.com
.相反,如果我请求我的 CloudFront 域名,比如说
dpw02sdffky7p.cloudfront.net
,我会被重定向到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.在 route53 中创建 cname 记录时,对于像 cloudfront 这样的端点,别名应该被指定为 yes,它将解决服务器端本身的重定向。
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html 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 https://serverfault.com/questions/419402/similarities-and-differences-between-cname-record-and-route-53-alias-record
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.