Before proceeding with custom domain setup, ensure you have completed the Firebase setup process as described in the Setup Firebase guide.

Overview

This guide will walk you through the process of connecting your custom domain to your Firebase hosting site. Firebase Hosting provides secure hosting with automatic SSL certificate provisioning for your custom domains.

Step 1: Access Firebase Console

  1. Go to the Firebase Console
  2. Select your project
  3. In the left sidebar, click on “Hosting”

Step 2: Add Custom Domain

  1. In the Hosting section, click on “Add custom domain”
  2. Enter your domain name (e.g., www.example.com)
  3. Click “Continue”

Step 3: Verify Domain Ownership

Firebase will provide you with a TXT record that you need to add to your domain’s DNS settings:

  1. Copy the provided TXT record value
  2. Go to your domain registrar’s DNS management page
  3. Add a new TXT record with:
    • Host: Your domain name (or @ for apex domain)
    • Value: The TXT record value provided by Firebase
    • TTL: 3600 (or as recommended by your registrar)

Step 4: Add DNS Records

After domain verification, Firebase will provide you with A records to add to your DNS settings:

  1. Add an A record for your apex domain:

    • Host: @ (or your domain name)
    • Value: 199.36.158.100
    • TTL: 3600
  2. Add an A record for www subdomain:

    • Host: www
    • Value: 199.36.158.100
    • TTL: 3600

Step 5: Wait for DNS Propagation

DNS changes can take anywhere from a few minutes to 48 hours to propagate. You can check the status in the Firebase Console under the “Custom domains” section.

Common Domain Provider Instructions

Cloudflare

  • TXT Record:
    • Host: example.com
    • Value: [verification value from Firebase]
  • A Records:
    • Host: example.com
    • Value: 199.36.158.100
    • Host: www
    • Value: 199.36.158.100

NameCheap

  • TXT Record:
    • Host: @
    • Value: [verification value from Firebase]
  • A Records:
    • Host: @
    • Value: 199.36.158.100
    • Host: www
    • Value: 199.36.158.100

Google Cloud DNS

  • TXT Record:
    • Host: example.com
    • Value: [verification value from Firebase]
  • A Records:
    • Host: example.com
    • Value: 199.36.158.100
    • Host: www
    • Value: 199.36.158.100

Troubleshooting

If you encounter issues during the setup process:

  1. DNS Propagation: Wait up to 48 hours for DNS changes to propagate
  2. SSL Certificate: Firebase automatically provisions SSL certificates, which can take up to 24 hours
  3. Domain Verification: Ensure the TXT record is correctly added and propagated
  4. A Records: Verify that both A records are correctly configured

Status Descriptions

  • Needs setup: DNS records need to be configured or updated
  • Pending: Domain is verified but SSL certificate is being provisioned
  • Minting Certificate: SSL certificate is being generated
  • Connected: Domain is fully configured and ready to use

For more detailed information, refer to the official Firebase documentation.