How to Really Map a Namecheap URL to Your Static Azure Cloud Website
You finally buy that cute-sounding website address, and then some time later, you pick a cloud platform to host your website. These days, that’s starting to be a typical scenario. Cloud computing has brought the price of owning your own website down to very reasonable costs. Likewise, with the expansion of website domain addresses beyond the classic “.com” URL, the cost and ease of getting your own web address has improved. But when it comes time to use your shiny new website address you bought at a domain name registrar like Namecheap.com to deploy your website to your inexpensive Azure cloud account, that’s where things get a little tricky.
Both Namecheap.com and Microsoft offer online Help articles to walk you through the process, but not specifically for deploying a Namecheap.com registered domain to a static Azure cloud storage account. Namecheap.com provides generic instructions for routing your URL to ANY cloud provider, and Microsoft offers generic instructions for creating DNS zone settings for URLs registered at ANY domain registrar, but no two domain name registrars and cloud platforms are the same. In other words, once you try to customize the settings for a specific Registrar-Cloud pair, the instructions can be frustrating. This article provides help for making your Namecheap.com URL work with your static Azure cloud website.
You may ask, “why not just buy the URL domain and website hosting from the same company, either Namecheap or Microsoft?” You can certainly do that, though Microsoft, as of this writing, does not sell domain name registrations. If you’ve hosted sites with WordPress or Shopify, you should know how this works. But what if, say six months later, you decide to switch hosting providers or the company goes out of business?
It’s a best practice to have your domain registrar separate from the hosting provider to avoid having one company monopolize your online presence. You can probably apply this help to other pairings, but you will likely encounter some hiccups along the way. But if simplicity is your number one goal, then it might be more convenient for you to have one company take care of everything for you. No need to read the rest of this article. But for those who already have a URL domain registered with one company (in this case, Namecheap.com) and are looking to host a website on another company’s cloud platform (in this case, Microsoft Azure).
Namecheap.com is my registrar, but most domain registrars work in similar ways. Without further ado, I will skip the verbosity and get right to it. The process of configuring your URL to work with your cloud account is as follows:
1. Have your URL domain registration info from Namecheap.com handy
2. In your cloud account portal, setup storage accounts for static websites
3. Configure your Azure cloud account so that your DNS configuration is ready to go with your DNS nameserver
Both Namecheap.com and Microsoft have tutorials to help you (links are provided). I won’t repeat the steps here. I suggest reading that now before continuing. I will focus on the details that are not so obvious that can frustrate you.
Helpful Info for Working in Namecheap.com
As you go through the Namecheap.com tutorial, with its references to IP addresses and A records, you may find it’s not exactly user friendly. Our friends in DNS Domain Registration and Web Hosting land are pretty technical and are so familiar with the networking jargon that they assume the rest of the world is at least familiar with things like CName records, A records vs AAA records vs TXT records, etc. Hang in there. The naming of these record types is a holdover from many years ago and none of the friendly nerds in DNS land have any incentive to make them user friendly.
In a nutshell, in order for the internet to know how to send web traffic and emails to your website address, it needs to be able to know what kind of traffic it is (web page request or email), what address to send it to, and the best route to deliver it through. This is similar to how the post office or drop shippers like FedEx works when delivering mail and packages to your address. Let’s briefly understand the most common record types.
· A records: Helps the internet route traffic to your main URL. For me, it’s SamsonaSoftware.com. It can be any valid domain like MyDomain.com. Alias record sets provide features similar to this record type.
· CNAME records: It seems intuitive that if I have an A record mapped to SamsonaSoftware.com, then the internet should just automatically send traffic via www. SamsonaSoftware.com. But nope. You need a CName record to make the “www” part of your web address to work.
· MX records: Used to setup your web address for email.
· TXT records: Use this to reject spam and authenticate your domain’s email authentication.
Fortunately, with Azure, you don’t need to worry about all of that as you will only need to re-route the managing of your DNS nameservers from your registrar to Azure by entering the 4 nameservers that Azure automatically creates for you when you go through the process of setting up your static website in your Azure storage.
Helpful Info for Working in Microsoft Azure
Compared to Namecheap.com, you’re going to spend more time in setting up Azure for your website. This is because Azure not only is handling the storage of your files, it also has to do the bulk of the work routing worldwide requests for your site pages and emails, as well as securing your site from threats and attacks. The way Azure does all of this is too complex for this article (you can read more here and here). Just know that when someone tries to visit your site, they have to jump through some security and routing hoops to get there.
Tip 1: CDN Endpoint Origin Type is “Custom Origin” not “Web App” since we used BLOB storage for our static website config. As you go through Microsoft’s tutorials, this fact may not seem obvious, but if you miss it, you’ll waste some time wondering why your website is not working.
Tip 2: In the Configuration page of your new Azure BLOB storage account, disable “Secure transfer required” for now so that regular HTTP requests to your page can be handled. Once you are ready for secure transfers, enable this setting. If you don’t disable it, the usual http://www... requests for your page won’t work, resulting in unauthorized errors. This will keep you from wasting time trying to figure out what’s wrong with your site.
Tip 3: Here’s what the Azure DNS nameservers will usually look like (and how they should entered in Namecheap.com):
Note that, in the Microsoft info, you’ll see a “.” (period) add at the end of the nameservers. You’re warned that some registrars drop the period or ignore it. Not Namecheap.com, as of this writing. If you leave the period at the end of the nameserver, your website won’t work! Be sure to drop the period when adding to Namecheap.
Tip 4: Create a custom domain to map the edge to your web URL to your BLOB storage URL. Yeah, this may sound ugly for those not used to this, but your storage account, which holds your files, can’t be directly exposed to the public. You’ll see as you go through the Microsoft tutorial. You’ll have to Create CNAME record to point your new “www” URL to your edge URL first. Creating a TXT record is helpful for verification purposes, so it’s good to create one as well.
For static websites, it’s easier to use alias record sets which automatically resolve to your website URL. If you prefer to use the IP address automatically assigned to your static web storage URLs, then you may have to ping the Azure edge URL and the windows.net URL — using the Ping command in a command prompt — to get the IP addresses in order to set the custom domain info. You’ll need IP addresses for the A record, and the Azure portal does not have a straightforward way of navigating to the IP assigned addresses for static websites.
That’s it. Keep this article handy when you map your Namecheap URL to your Azure cloud hosted website. This will save you lots of time when things go wrong (and they usually do when undergoing such an exercise).
About the Author
John Conley is an independent technology consultant for Samsona Software as well as a freelance writer based in Dallas, TX.