How to point wildcard domain (*.example.com) to s3

2019-08-25 11:19发布

问题:

I have SSL Certified and setup a homepage for my site: example.com and www.example.com using Cloudfront, Route 53, and an s3 bucket. The site is just a basic static site.

I am trying to setup my Cloudfront/Route 53 to allow for WildCard subomdains so I can create some landing pages eg, industry-a.example.com, industry-z.example.com and have them point to separate static s3 buckets.

I have tried adding in *.example.com to my Cloudfront and Route 53

I have a hosted zone created for a domain from namecheap in Route 53 with the following records:

Type        Name                Target
A Record     -> example.com     -> My.cloudfront.net
A Record     -> www.example.com -> My.cloudfront.net
CNAME Record -> *.example.com   -> s3-website.us-east-2.amazonaws.com.

In my CloudFront distribution configuration:

Alternate domains set to:

example.com
www.example.com
*.example.com

Domain Name:

My.cloudfront.net

Origin ID:

example.com.s3-website.us-east-2.amazonaws.com