In the previous tutorial, I showed you how to host a web application by using Firebase Hosting. But Firebase just gives us their own domain to connect to our application. In this tutorial, I gonna reveal to you how to connect a custom domain to Firebase Hosting
Register new domain
- Firstly, we need to register a new domain. We can buy that domain via some domain services such as https://domains.google.com/, https://www.domain.com/ … In this tutorial, I just use a free domain from https://www.freenom.com. The registration process in Freenom is similar to other services.
- Access https://my.freenom.com/clientarea.php and login with your account (Register a new account if you haven’t had it yet)
Select “My domain” from the menu
- Choose a name for your domain
Select a free one:
Checkout your selected domain:
After complete your order, now you’re the owner of that new domain
Connect new registered domain to Firebase:
- Access firebase project overview, choose “Hosting” and click on button “Connect domain”
- Input your custom domain you have just register successful
- Copy the value for DNS record:
- Keep the browser tab for Firebase here, we’ll revisit later. Open a new tab and access: https://my.freenom.com/clientarea.php?action=domains and select “Manage domain”
After this tep. Move back to Firebase browser tab and click “Verify” button
If you get the error message, please wait several minutes and verify again, because it takes time to update DNS record. Try to verify many times until you are successful
When verification is successful, Firebase gives us 2 DNS records. We need to copy these value and paste it to our domain DNS
When we finish update DNS record, try to access our domain in a browser and check the result (Maybe we need to wait some hours for our changes take effect)
Remember that in the first time, we will get the warning for the invalid certificate, don’t worry Firebase will help us to deploy a valid one some hour later. At this time just try to proceed with unsafe
Result will be look like this:
We’re now successful to connect our custom domain to Firebase hosting.
In this post, I have just shown you how to register a free domain as well as connect it with current Firebase Hosting. In the next post, I gonna show you how to deploy a React application and deploy it to Firebase. See you later!