Search code examples
subdomainamazon-cloudfrontamazon-route53cname

Why can't I create a subdomain with www in CloudFront?


Can you please help me figure out why I cannot create a subdomain with www?

I have domain.com. I have a certificate for said domain that includes: www.domain.com, domain.com, and *.domain.com.

I want to create www.subdomain.domain.com records through AWS CloudFront.

I can create subdomain.domain.com no problem. I just cannot create the www version. I get an error that states The certificate that is attached to your distribution doesn't cover the alternate domain name (CNAME) that you're trying to add.

That should be covered by *.domain.com, no?

Attempts to create the CNAME record in Route53 manually have also been no help. I don't get the CNAME error, but I still get 403 errors on www.subdomain.domain.com.


Solution

  • The www.subdomain.domain.com is indeed not covered by your certificate. The *.domain.com wildcard covers domains like: subdomain1.domain.com, subdomain2.domain.com, etc; it doesn't cover www.subdomain.domain.com because the * wildcard works only for a single subdomain (first subdomain after the dot). For this to work, your certificate would need to cover *.subdomain.domain.com.