6/12/16

Azure Web App Only Loads with WWW Prefix

When moving a website to Azure, we need to verify with Azure that we own the domain name. This verification process is done by adding a CNAME record on the DNS provider (i.e. enom, godaddy) that holds the domain name.  To verify the domain name, we usually add the following two records:

From Url
Type
Target Url
www.ozkary.com
CNAME
ozkary.azurewebsites.net
awverify.www 
CNAME
awverify.ozkary.azurewebsites.net


After making those changes on the DNS providers, azure is then able to verify the site and approves the domain name into our configuration. At this point however, we are only able to load the web app by using www prefix (i.e. www.ozkary.com). When trying to browse the app entering just the domain name (ozkary.com not using www), we get an error from Azure indicating that the site is not configured properly.

To address this problem, we need to also add the domain name without the www prefix, but in order to add this on Azure, we also need to add the verify CNAME without the www prefix on the DNS provider.  In short, we also need to add the highlighted entry:

From Url
Type
Target Url
www.ozkary.com
CNAME
ozkary.azurewebsites.net
awverify.www 
CNAME
awverify.ozkary.azurewebsites.net
awverify
CNAME
awverify.ozkary.azurewebsites.net


We should notice there is no www part just the word awverify. We can now go back to Azure and add the domain name with the www prefix. We should see that Azure verifies the domain, and we should be able to load the web app with or without the www prefix.

Originally published by ozkary.com