I am hosting a static website using the following Azure Resources:
- Azure Storage Account
- Azure CDN
- CDN End Points
- DNS Zone
and my domain is purchased from GoDaddy.
The implementation is very straightforward:
- I deploy my static website to the storage account and all is fine I got my primary and secondary URLs which are both working fine
- In my CDN profile, I have created an endpoint pointing to my storage account URL and as a result, a new endpoint resource was created testing endpoint hostname works perfectly
- My DNS Zone is based on my GoDaddy purchased domains I already added the @ record of the type "A" and the www record of the type "A" as well also Azure automatically created 2 additional Cname Records for CDN verify purpose
- back to the endpoint that I created in the CDN I add 2 custom domains for my web site which are "example.com" & "www.example.com" both URLs work fine now and open the site hosted in the Storage account but it's happening over HTTP, not HTTPS
- I click on the www.example.com custom domain in the endpoint overview blade and from the new blade I select on for custom domain HTTPS and choose CDN managed and click on save after some time for verification it works fine and www.example.com is working over HTTPS
- repeating the same step 5 for the naked custom domain in the endpoint is not working as when I click on save it is throwing an error
We couldn't find a DNS record for custom domain that points to endpoint. To map a domain to this endpoint, create a CNAME record with your DNS provider for custom domain that points to endpoint.
My ultimate goal is to be able to open both www.example.com and example.com over HTTPS, if I can fix this error or perhaps follow an alternative implementation there is no problem with that, or if it's possible to redirect without a redirection server from the naked domain to the www it would be fine as well I am open to any solution.
I tried adding a cname with naked domain value to my DNS zone but I am learning that it's not possible as I have to provide a prefix to the .example.com when creating a cname in the Azure DNS zone.