简体   繁体   English

具有自定义域路由的 AWS Cloudfront

[英]AWS Cloudfront with custom domain routing

I've got two s3 buckets and two cloudfront endpoints for each one.我有两个 s3 存储桶和两个云前端端点。 I want to use custom domains instead of cloudfront defaults.我想使用自定义域而不是云端默认值。 Right now I see there's only one way to do it - create 2 subdomains and point each one to a cloudfront endpoint respectively.现在我看到只有一种方法可以做到这一点 - 创建 2 个子域并将每个子域分别指向一个云端端点。

What I would want to do is to create a single subdomain, for instance storage.example.com and use the following routing for my cloudfront endpoints:我想要做的是创建一个子域,例如 storage.example.com 并为我的云端端点使用以下路由:

storage.example.com/audio  // points to the first cloudfront endpoint
storage.example.com/video  // points to the second cloudfront endpoint

I'm using Namecheap's DNS and SSL certificates.我正在使用 Namecheap 的 DNS 和 SSL 证书。 Is there a way to achieve it?有没有办法实现它?

You can only do this with a single CloudFront distribution.您只能使用单个 CloudFront 分配来执行此操作。 You can use the CloudFront behaviors to choose the origin.您可以使用 CloudFront 行为来选择源。 You can create a behavior for audio/* and use the audio bucket as the origin.您可以为audio/*创建一个行为,并将音频存储桶用作源。

Note that the url path is not modified by the behavior so in the audio bucket all objects would need to be prefixed by audio .请注意,url 路径不会被行为修改,因此在音频存储桶中,所有对象都需要以audio为前缀。 eg storage.example.com/audio/some/path/audiofile.mp3 would require that the S3 object's key be audio/some/path/audiofile.mp3例如storage.example.com/audio/some/path/audiofile.mp3将要求 S3 对象的密钥为audio/some/path/audiofile.mp3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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