About: a guide on setting up a domain name with NameCheap to Heroku app.
I hope while you are reading this blog you have successfully deployed your application to Heroku. And know thinking about adding a domain, yeah! you're in the right place.
Steps to set up a domain name
- Adding domain to Heroku.
- Setting up DNS target with Namecheap.
If you haven’t purchased your domain name yet. Watch this, or Read this.
Done!, Will start…
1. Adding Domain Name To Heroku
- From your project directory runs this command, enter the domain name with “www.” meusama.dev It’s mine.😀
heroku domains:add www.meusama.dev
- Navigate to your Heroku app => settings => Domains and certificates section, There you see your domain name with DNS target, copy DNS target to clipboard. DNS target will be like
encircled-magnolia-9265.herokudns.com
- If not just add your domain name by clicking the Add domain button and enter your domain name with “www.”
- And successfully we had added our domain name to Heroku app.
2. Setting up DNS target with Namecheap.
- Go to your Namecheap dashboard and click the manage button on your domain name tab.
- And you will navigate to ‘domain control panel’. on there click Advance DNS tab.
- Paste your DNS target to CNAME record where Host points to www. After pasting DNS target add a dot at the end.
encircled-magnolia-9265.herokudns.com.
- You have done half of the work, but DNS propagation takes time. Set TTL to a minimum time in that way you can reduce propagation time.
- You can use Google Flush Cache tool to flush NS and record to your domain name. To check if everything working correctly.
- Go to Google Flush Cache tool and Enter your domain name, If CNAME matches your Heroku DNS target, Then you have done with it.
- Try visiting your domain name, If you get this message “This site can’t provide a secure connection”, then set up an SSL certificate with ACM. Very simple to set it up.
- This blog provides the guide.
If you have any problem with setting up the domain name with this guide, Please feel free to comment below.
Thank you with ❤