Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in GCP by (19.7k points)
recategorized by

I can't see any option anywhere to set up a custom domain for my Google Cloud Function when using HTTP Triggers. It seems like a fairly major omission. Is there any way to use a custom domain instead of their location-project.cloudfunctions.net domain or some workaround to the same effect?

I read an article suggesting using a CDN in front of the function with the function URL specified as the pull zone. This would work, but would introduce unnecessary cost - and in my scenario, none of the content is able to be cached so using a CDN is far from ideal.

closed

1 Answer

+1 vote
by (62.9k points)
selected by
 
Best answer

Connect a custom domain

You can connect custom domains (like example.com or myrealtimeapp.example.com) to a Firebase Hosting site.

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

Generally, Firebase Hosting recommends no more than 20 subdomains on any of the one apex custom domain, due to SSL certificate minting limits.

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.

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

If you have only one Hosting site, click the Connect domain.

If you have more than one Hosting site, click View for the desired site, then click the Connect domain.

Enter the custom domain that you'd like to connect to your Hosting site.

(Optional) Check the box to redirect all requests on the custom domain to a second specified domain.

Click Continue to initiate the validation process. Then, if requested, verify your domain ownership by following the instructions in the setup wizard.

These steps ensure that your domain hasn't already been linked with a Firebase project and that you own the specified domain.

Note: To map TXT records directly to your domain name, some domain providers require that you enter @ for the Hostname. Refer to your domain provider's documentation for detailed instructions for adding TXT records.

To complete the custom domain setup, you can use the Quick Setup mode in most cases.

However, if you already have a site running on another hosting provider and need a zero-downtime migration, then select Advanced Setup from the setup mode dropdown list.

Quick Setup — Point the DNS A records for your domain to Firebase Hosting.

Advanced Setup — Follow the on-screen instructions either to update your domain's DNS TXT records or to upload a file to a specified location on your existing site. After verification is complete, you can safely point your DNS A records to Firebase Hosting.

Firebase provisions an SSL certificate within 24 hours after you point your DNS A records to Firebase Hosting.

Browse Categories

...