Buy Me a Coffee

Buy Me a Coffee!

Monday, January 25, 2021

Adding a custom domain to a static site

(written on Feb 2nd and back published to Jan 25th)

 Now that we have our static site, it would be more convenient to use a custom domain than the <xxx>.<xxx> address that is provisioned by default.  There is a guide and we should be able to do it as our guest user, so log back into the portal using your guest account and click on the storage account under Recent resources

In the search box type custom and click on <custom domain>

Once there, you will be given a place to type in your custom domain and type in the domain name you are going to use.  I have been playing around with the domain for some time now and use it for experiments such as this.  I will talk about how to get a domain name in another article, but for now I am just going to type in into the domain name box and then in the section 1 above that box you need to highlight the address of the site and put it on your clipboard
Now, following the instructions you need to create a CNAME for your url and point it to the captured address.  For me, I do this in CloudFlare.  I host all of my DNS there, regardless of where I buy my domain name.  It is fast and convenient and free.  So, I set up a CNAME with the name www and paste in my site address of and click <save>

Then I go back to Azure Portal and click <save>
Now, I can see my site by going to!  Well, not quite yet.  If you just put in the address, many browsers will try to go to which will fail with an error message because HTTPS is required by default on our static site:
Going to is better, but you should (using a modern browser) be given some harsh warning like this
because the SSL certificate doesn't match the url you are using.  This is a GREAT THING!  Using Pale Moon, you can click through and see your site by clicking on <i understand the risks> and then on <add exception>
Uncheck the <permanently store this exception> and then on <confirm security exception> 
And you are in

But at what cost?  It is inconvenient.  What do we do to fix this?  Add our domain name to an SSL certificate and put it on the site.  We will work on that next time.