简体   繁体   中英

AWS Cloudfront with custom domain routing

I've got two s3 buckets and two cloudfront endpoints for each one. 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.

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/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. Is there a way to achieve it?

You can only do this with a single CloudFront distribution. You can use the CloudFront behaviors to choose the origin. You can create a behavior for audio/* and use the audio bucket as the origin.

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 . eg storage.example.com/audio/some/path/audiofile.mp3 would require that the S3 object's key be audio/some/path/audiofile.mp3

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