How to configure www & root domain in hashnode over SSL.
Configure redirection for your custom domains
Before we start, let me ask you a question:
Are you using custom domain in hashnode to show your posts?
If your answer is Yes, then this post is for you.
Is your intention to show your posts on hashnode on a custom domain with www and a root domain(like www.thebiggtalks.com and thebiggtalks.com) over SSL (https).
How I ended up writing this post
A few days back, when i tried to configure my domain in hashnode, i noticed that, something is broken. Either one of the https://www.thebiggtalks.com or https://thebiggtalks.com will work. But if I call http://www.thebiggtalks.com or http://thebiggtalks.com, then both will be redirecting to right endpoint. So I started looking at other blogs in hashnode which use custom domains, then I realized that most of them are facing similar issue.
After reconfiguring multiple times, i was able to serve my blog over both www and root domain, where one will be redirecting to the right domain configured in hashnode.
So here I want to share my configuration which i used, so that everyone can benefit out of it.
I'm using Google Domains as a domain name registrar; later we can see how we can achieve it in Godaddy or any other similar platforms. And there is a difference in configurations w.r.t Google domains vs Godaddy or other platforms, so the below google domain configuration might not work for other platforms, if you are not using google domains, you can directly jump to Godaddy configuration which will be similar to other platforms like namecheap, cloudflare, synergywholesale etc.
Configuration in Google Domains
Here the hashnode configuration is thebiggtalks.com
Configure the A record as show in screenshot.
Configure the Forwarding as shown below.
You are done, wait for sometime and start accessing your endpoint and verify it is working.
Configuration in Godaddy
Here the hashnode configuration is www.thebiggtalks.com
Configure the A record as show in screenshot.
Configure CNAME record.
Configure the Forwarding, here select domain or subdomain depending on your requirement to forward. I'm selecting Forward domain to achieve the same which i showed above.
You are done, wait for sometime and start accessing your endpoint and verify it is working.
Configuration in Namecheap
Here the hashnode configuration is www.thebiggtalks.com
- Configure the A record and CNAME as show in screenshot.
Similarly, you can configure the same if you are using a different domain name registrar other than Google domains/Namecheap/Godaddy. I have tried only with these 3 platforms.
Before we conclude, Key points to keep in mind
The below points can be followed for any DNS portals.
- Always add A record and CNAME record in DNS management portal.
- Add a redirection from root domain to subdomain (http) in the portal.
- Then create root domain/subdomain in hashnode. If that didn't work try creating and deleting multiple times in hashnode.
- Better to configure subdomain in hashnode. Because from my personal experience I have faced sometimes subdomains are not properly redirecting to root domains in some portals. So always configure subdomain in hashnode and do a redirection from root domain to subdomain.
A few other resources which may help you to configure custom domains:
Thanks for reading, please share it within your network, if this resonates with you.
You can also connect with me on twitter as I will be inscribing my thoughts there very frequently.