Connect a custom domain

You don't have to give up your unique, brand-centric domain names with Firebase Hosting. You can use a custom domain (like example.com or app.example.com) instead of a Firebase-generated domain for your Firebase-hosted site.

Firebase Hosting provisions an SSL certificate for each of your domains and serves your content over a global CDN.

The rest of this document walks you through these steps to connect your custom domain.

Set up your domain for Hosting

Make sure that you've completed the "Get Started" wizard from your project's Firebase Hosting page so that you have a Firebase Hosting site in your Firebase project.

Step 1: Add custom domain

  1. From your project's Hosting page, enter the wizard for connecting a custom domain:

    • If you have only one Hosting site, click Add custom domain.
    • If you have more than one Hosting site, click View for the desired site, then click Add custom domain.
  2. Enter the custom domain name that you'd like to connect to your Hosting site.

  3. (Optional) Check the box to redirect all requests on the custom domain to a second specified domain (such that example.com and www.example.com redirect to the same content).

  4. Click Continue to configure your DNS records and finish setting up your custom domain.

Step 2: Setup custom domain

If requested in the Connect Domain setup wizard, verify your apex domain.

These steps ensure that your domain is not already linked with a Firebase project and that you own the specified domain.

  1. In your domain provider's site, locate the DNS management page.

  2. Add and save a new record with the following inputs:

    • Type: Add a TXT record.

      Firebase Hosting requires that you keep this TXT record continually present in your DNS settings to prove your ownership of the domain and to authorize Firebase to assign and renew SSL certificates for your site.

      Your domain provider may list this term as "Record Type".

    • Host: Enter your apex domain key.

      Proving your ownership of an apex domain, or root domain, proves your ownership of all its subdomains.

      Your domain provider may list this term as "Host Name", "Name", or "Domain".

    • Value: Copy the unique verification value into the field.

      Firebase Hosting checks for this value to prove your domain ownership.

      Your domain provider may list this term as "Data".

  3. Allow up to 24 hours for propagation of your updated TXT records, then click Verify.

    Note that you may click Cancel to safely close the Connect Domain window and reopen at a later time. This does not affect the propagation time, but you will be prompted to re-enter your domain name when you reopen the window.

    After ample propagation time, clicking Verify in the Connect Domain window of the Firebase console allows you to begin the SSL certificate provisioning process.

    In most cases, propagation of your records and verification of your domain will happen within a few hours, depending on your domain provider. Refer to your domain provider's documentation for detailed instructions for adding TXT records and propagation times.

    If clicking Verify prompts an error message, your records have not propagated or your values may be incorrect.

In the Add Custom Domain wizard of the Firebase console, select Quick Setup or Advanced Setup.

Quick Setup can be used for new domains that are not currently receiving traffic or domains that you are attempting to transfer from another Hosting site. Advanced Setup can be used if you already have a domain receiving requests on another hosting provider and need a zero-downtime migration.

The Advanced Setup wizard will help you establish an SSL certificate and ownership claim to allow Hosting to serve traffic on the domain before receiving traffic.

Wait for SSL certificate provisioning

After we verify domain ownership, we provision an SSL certificate for your domain and deploy it across our global CDN within 24 hours after you point your DNS A records to Firebase Hosting.

Your domain will be listed as one of the Subject Alternative Names (SAN) in the FirebaseApp SSL certificate. You can view this certificate using the browser's security tools. While the domain is provisioning, you might see an invalid certificate that does not include your domain name. This is a normal part of the process and will resolve after your domain's certificate is available.

For Advanced Setup users, your website will be hosted by your previous hosting provider until the setup status in your project's Firebase Hosting page updates to Connected.

Your custom domain key

When adding or editing DNS records, different domain providers expect you to enter different inputs for the Host field within their DNS management sites. We've compiled common inputs from popular providers below. Refer to your domain provider's documentation for detailed instructions.

Domain type Custom domain key
Apex domain

Common inputs include:

  • @
  • The apex domain name (for example, example.com)
  • Leaving the Host field blank
Subdomain

Common inputs include:

  • The full subdomain name (for example, app.example.com)
  • Only the subdomain portion (for example, app only, and leaving out .example.com)
  • Only www for the subdomain of www.example.com

Common domain providers

Here are some common domain providers and the types of input each might require. This information is kept up-to-date as much as possible, but refer to your domain provider's documentation for detailed instructions.

Setup status descriptions for custom domains

Status Description
Needs setup

You may need to change a configuration with your DNS records.

  • In most cases, your DNS A records haven't propagated from your domain name provider to Firebase Hosting servers.
    Troubleshooting tip: If it's been more than 24 hours, check that you've pointed your records to Firebase Hosting.

  • In rarer cases, especially if you're using the Advanced Setup flow, SSL challenges might be failing because:

    • SSL certificate challenges failed, and the token (DNS TXT records or uploaded file provided to your site) is now invalid.
      Troubleshooting tip: Click View for the domain, then provide the new token to your existing domain.
Pending

You correctly set up your custom domain, but Firebase Hosting hasn't provisioned an SSL certificate.

Occasionally, the following issues can stall the minting of an SSL certificate for a custom domain:

  • Your CAA records are too restrictive.
    Troubleshooting tip: Ensure that the certificate authorities `letsencrypt.org` and `pki.goog` are allowed to create SSL certs for your domain.
  • Your challenge code is invalid.
    If you're using the Advanced Setup flow and migration failed, your token (and its challenge code) are now invalid.
    Troubleshooting tip: Click View for the domain, then provide the new token to your existing domain.
  • You requested certs for too many subdomains.
    Troubleshooting tip: Generally, Firebase Hosting recommends no more than 20 subdomains on one apex custom domain, due to SSL certificate minting limits.
Minting Certificate

An SSL certificate is being produced for your domain.

Connected

Your custom domain has the proper DNS records and has an SSL certificate.
You can serve your site's content.