Custom Domains For Windows Azure Web Sites Using Domain Masking
If you read the Azure documentation on Configuring a Custom Domain Name for a Windows Azure Web Site, it describes configuring a custom domain for a Windows Azure Web Site using a CNAME record with your domain registrar. You’ll also read that to do this, your web site has to run on a “Reserved Instance” as opposed to a “Shared Instance”. But, there’s also a way to get a custom domain mapped to your web site while staying with a “Shared Instance”.
The technique is to use Domain Masking. I’ve seen it also called URL Frames, URL masking and URL cloaking. It depends on your domain registrar. Regardless, the trick is for the browser to use a URL redirect in conjunction with a frame to load a web site while preserving the custom domain name in the address bar. This isn’t as clean as using a CNAME record which avoids the redirect and doesn’t use a frame, but it’s a simple alternative that might meet your needs.
You can see this in action if you visit bushschooladventure.com. A request to the web site causes a browser redirect to bushschooladventure.azurewebsites.net which is where the site is actually hosted.
Here’s the network trace for the request in Fiddler:
Notice that request #2 results in an HTTP 302. That’s the browser redirect from “bushschooladventure.com” to “bushschooladventure.azurewebsites.net”. Looking at the URL address in the browser though, it still says “bushschooladventure.com” which is perfect. If I had used a plain URL redirect, the address bar would have shown “bushschooladventure.azurewebsites.net” which is undesirable.
Looking at the page source, we can see a <frameset> being used:
To configure this with my domain registrar, Namecheap, I set the following hostname records for a “URL Frame”. GoDaddy calls it domain masking.
You can’t see the full URL in the text boxes there, but I assure you that it points to “bushschooladventure.azurewebsites.net”.
And that’s it! A custom domain name for my Windows Azure Web Site without running the site on a reserved instance machine.
Hope this helps,