In this tutorial, we will walk through the process of using your custom domain with Firebase Hosting and securing it with SSL. Firebase Hosting provides a fast, secure, and reliable way to serve your web app, and it is even better when used with your own custom domain.
By the end of this tutorial, you will be able to:
To follow this tutorial, you will need:
The first step is to add your custom domain to Firebase. Here's how:
Tips: The changes to DNS settings may take up to 24 hours to propagate across the internet. Be patient.
Once your custom domain is connected to Firebase Hosting, Firebase will automatically provision and manage an SSL certificate for your domain. This ensures that your website is served over HTTPS, providing a secure connection for your users.
Tips: SSL certificate provisioning may take a few hours. You can check the status in the Firebase console.
While this process doesn't involve much coding, you may find the following Firebase CLI commands useful:
# Initialize a new Firebase project
firebase init
# Deploy your website to Firebase Hosting
firebase deploy
firebase init
command sets up a new Firebase project in your local directory. It asks a series of questions to set up your project.firebase deploy
command deploys your website to Firebase Hosting. It should be run in the root directory of your website.In this tutorial, we have learned how to connect a custom domain to Firebase Hosting and secure it with SSL. Firebase automates much of this process, making it easy to use your own custom domain and ensure it is secure.
Next, you might want to learn more about Firebase features such as Firestore, Authentication, and Cloud Functions. These can help you build more complex and powerful web apps.
The official Firebase documentation is a great place to start: Firebase Documentation
Solution: Follow the steps in the tutorial. Use the firebase init
and firebase deploy
commands to set up and deploy your project. Check the HTTPS by looking at the URL bar in your browser - it should show a lock icon.
Exercise 2: Connect a second custom domain to your Firebase project. Ensure that it is also served over HTTPS.
Solution: In the Firebase console, go to the Hosting section and click on "Add another domain". Follow the same steps as before to verify and connect your domain. The SSL certificate will also be automatically provisioned.
Exercise 3: Try to understand what happens if you don't secure your domain with SSL. Research on why SSL is essential.