What I understand from CNAME record is that, if we have this record in our Authoritative Name Server, then the DNS resolver will resolve for the CNAME record’s pointed path.
Let suppose I have test.azurewebsites.net, and I also own mynameistest.com, now I go and create CNAME record in my DNS Provider with the below details:
www.mynameistest.com CNAME test.azurewebsites.net
If I have created this record successfully, isn’t it enough as I will be pointing the DNS query to the hosted app service? Why do I need to tell Azure App Service that I have created a custom domain name for it with hostname as "www.mynameistest.com".
2
Answers
Will the IP Address point to that of test.azurewebsites.net if CNAME is added?
Adding the CNAME record pointing to test.azurewebsites.net will make the DNS resolvers resolve queries for mynameistest.com to the IP Address associated with test.azurewebsites.net.
Is this NOT enough?
No. This is NOT enough, as the Azure App Service (or the underlying server, in general) needs to be "instructed" to respond to the requests for "mynameistest.com".
How does the server know the URL(FQDN) being requested? Isn't it all about IP Addresses?
During the TLS/SSL Handshake, when the client sends the "Client Hello" message, it embeds some "Extensions" header in it, one of those extensions is, "server_name", which tells the TLS/SSL Layer (of server) that which FQDN is being requested. Now, if the server is unaware of this, it will respond with 404 (Not Found). But if the server knows about this, it will send out the corresponding SSL Certificate from its pool of certificates (A server can host multiple websites/domains, and each of them can have one SSL Certificate, this is called Virtual Hosting).
The above is reason why, we need to tell the Azure App Service to serve the requests for "mynameistest.com", and this "instruction" is given via adding the custom domain from the portal.
Check the below steps:
In
DNS Zone
, while creatingCName
you can clearly see intype
toLink your subdomain
.There is no option related to the
App Service
in the createdDNS Zone CName - record set
forAzure resource
Even if we provide the Alias name, we cannot see any option for
App Service
.Initially I have not given Alias in the created
CName
.Now, in my
Azure App Service
, I have added thecustom domain
withsubdomain
.Now when I check in the created
CName
inDNS Zone
, I can see the Alias name is added with theWebApp
name.When we assign the
Web App
to the created domain name, the domain name will be available in theAlias
.So, it is necessary to tell the App Service which
CName
we have to use.