Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

amazon web services - AWS route53 domain not working with www prefix

I have a domain with AWS with static website hosting option with S3.

Have all my static files under S3 with the bucket name as

domain.com

Since I need https, I created CloudFront with the following alternate CNAMEs.

domain.com 
www.domain.com

Have A records for both domain.com & www.domain.com.

For domain.com --> CloudFront

For www.domain.com --> route to domain.com

Hitting, domain.com works, but www.domain.com gives error that bucketname wwww.domain.com doesn't exist.

I can create one more bucket with www.domain.com and copy all the static files. Is this the only approach?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

as per the documentation you just need to configure the redirects from the subdomain bucket. No need t o copy the objects from the root bucket. quoting from the doc

After you configure your root domain bucket for website hosting, you can configure your subdomain bucket to redirect all requests to the domain. In this example, all requests for www.example.com are redirected to example.com.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...