/firebase-tutorials

How to enable HTTPS in Firebase hosting?

Enable HTTPS in Firebase Hosting: install the Firebase CLI, log in, initialize and deploy your project, and secure custom domains with free SSL certificates.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to enable HTTPS in Firebase hosting?

 

Step 1: Install Firebase CLI

First, you need to install the Firebase CLI on your machine. If you haven't already, follow the instructions below to install the CLI.

Open your terminal and run the following command to install Firebase CLI globally using npm (Node Package Manager):

npm install -g firebase-tools

This command will ensure you have access to all Firebase CLI commands from any directory.

 

Step 2: Log in to Firebase

Before you can use Firebase services, you need to log in using the Firebase CLI. Execute the following command in your terminal:

firebase login

This command will open your browser and prompt you to log in to your Google account. Make sure you use the account associated with your Firebase projects.

 

Step 3: Initialize Firebase Hosting

Navigate to your project directory using the terminal. If you don't have a project yet, create a new directory and navigate into it.

Next, run the following command to initialize your Firebase project:

firebase init

You'll be prompted to select the Firebase features you want to set up. Use your arrow keys to navigate to "Hosting" and select it by pressing the space bar, then press enter to confirm your choice.

Continue through the setup prompts. You'll be asked a series of questions about your project:

  • Select a Firebase project: Choose an existing Firebase project or create a new one. it's important to host under a project's domain for obtaining an SSL certificate.

  • What do you want to use as your public directory? Specify the directory that contains your static files (usually public).

  • Configure as a single-page app? Choose yes if you're deploying a single-page application (like those built with React, Angular, or Vue.js). Choose no if your app has multiple entry points.

 

Step 4: Deploy Your Application

Now that your Firebase Hosting configuration is set, you're ready to deploy your application. To do this, run the following command:

firebase deploy

Firebase CLI will upload your files to the Firebase servers, and they'll be hosted at https://<your-project-id>.firebaseapp.com.

 

Step 5: Enable HTTPS

Firebase Hosting automatically provides a free SSL certificate for your custom domain, ensuring your project uses HTTPS out-of-the-box if you're using the firebaseapp.com subdomain.

If you're using a custom domain, you need to add it to your Firebase Hosting setup. Follow these steps to enable HTTPS for a custom domain:

  • Go to the Firebase Console.
  • Navigate to your project.
  • Click on "Hosting" from the left-hand side menu.
  • Click the "Add custom domain" button.
  • Follow the prompts to verify domain ownership and update your DNS records.

Firebase will automatically provision and renew SSL certificates for any custom domain you add. After setting up your domain, it may take a few minutes for the HTTPS to be active.

That's it! Your Firebase Hosting project is now accessible over HTTPS.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022