Simple DNS Administration (Web Development)
Simple DNS Administration
You have bought a domain name and you have your blog running in GitHub pages or you have an app running on Heroku. Now what? How do I make the domain name point in the right direction?
In my case, I bought my domains on one.com and I will use this in the following example. There are probably some differences to your provider.
The reason for this article is that getting this right through trial and error is hard. Especially due to the propagation delay of DNS rules that can take up to 48 hours and due to the jargon. There are a lot of new terminology and abbreviations. It is actually quite intimidating.
So you want to get as much right from the start as possible.
Further, you should observe that though it is not expensive, it is not for free. More on that later.
One.com
Buying the domain name is easy enough. But you have to pay attention to the plan. Maybe the plan is just for the domain name, maybe email is included, but you need a plan that includes more. At one.com this plan is currently named Beginner. The email plan is not enough.
Let us assume that we have bought the domain example.com
.
Go to DNS Administration. We have to set up two things: CNAME and Web forward.
CNAME Record
This is the pointer to your content.
Set the following information
- Hostname:
www
. The www is a subdomain. - is an alias: This is the DNS Target or Destination. See below.
- TTL (seconds): Leave it empty. The default is 3600 seconds.
Web forward
You probably want example.com
to redirect to www.example.com
. For two reasons.
- Search Engine Optimization (SEO). So that the page ranking is not split between the two.
- You risk that
example.com
points to nowhere and the user gets a site under construction message.
For this you want to use the Web forward option and not Redirect or Web alias.
- Hostname: Leave it blank. This is called the naked domain.
- Will direct to:
https://www.example.com
. Enter the complete URL.
GitHub Page
For this to work, it is a precondition that you are on a paid plan. I use the Team plan which is currently 4$ per user per month. The Free plan does not provide an SSL certificate.
DNS Target
example.github.io
Custom domain
Set the custom domain to www.example.com
and click save.
Then set the Enforce HTTPS.
You should see a DNS Check in Progress
and wait till it says DNS check successful
.
In the top of the page GitHub Pages you see the message: Your site is live at https://www.example.com.
Heroku
For this to work, it is a precondition that your project is on a paid Dyno. I use the Basic Dyno which is currently maximum 7$ per month. The Eco dyno type does not provide an SSL certificate.
Configure Certificate
Chose the Automatic Certificate Management (ACM) this is free when you are on the Basic Dyno. Then you will see a confirmation: Your certificate is automatically managed.
Now click Add domain and add www.example.com
. Heroku will now give you the DNS Target that you need for the CNAME above.
DNS Target
something-funny-xyz.herokudns.com
Tests URL
Test your site by typing
- example.com
- www.example.com
- http://example.com
- https://www.example.com
They should all direct to https://www.example.com.
whatsmydns.net
When you set everything up, it might not work right away.
To follow how the DNS records propagates you can use this DNS Propagation Checker.
Try the following
https://www.whatsmydns.net/#CNAME/www.microsoft.com
dig CNAME www.example.com
From the terminal try this
dig CNAME www.example.com
You can also use an online tool like https://toolbox.googleapps.com/apps/dig/#CNAME/
Trouble shooting HTTPS
If you cannot check the Enforce HTTPS on GitHub Pages, check that you are on a paid plan and all the steps. If this fails, then wait a day and try again.
Similar, if Heroku says that your site is available on http (without the s) then check you are on a paid Dyno and all the steps and similar, if that fails, wait a day and try again.
Be patient.
Conclusion
If you think this is too complicated, you are not alone. It is.
When you start to google for information and read all the help pages on one.com, GitHub Page and Heroku, the amount of information is overwhelming and you don’t really know what is important and what can be ignored.
I got help from a friend, the one.com support team and ChatGPT.
I hope that this article got you started.