Connecting your domain using Google Firebase (with Node.js)


Google Chrome announced that, starting this October, it would show a "Not secure" message in the address bar for URLs served over HTTP. Most major sites-Google, Facebook-had already moved to HTTPS.

With Firebase, you can get your own SSL certificate (for free) and stop worrying about the "Not secure" warning even if you don't already own one. You can create a Firebase project at Google Firebase using your Google account.

Create a new project

Main page of Google Firebase Main page of Firebase - add a new project by clicking the "Add project" (red box) button.

Create a new project Create a new project

A dialog appears after you click "Add project." Name the project and select your country. I chose South Korea, but I recommend choosing the country with the closest CDN region.

Start Google Firebase

Go to the Hosting tab Go to the "Hosting" tab in the left navigation and click "Start" on the Hosting page.

Hosting setup (1) Set up your local directory first-open Terminal by holding Shift while right-clicking inside your directory. Copy and paste the npm commands: install, sign in, init, and deploy.

You need to set up your local directory because Firebase Hosting uses Node.js's command-line interface, not an FTP server or a web hosting manager. Make sure Node.js is installed on your computer.

Login and initialize Firebase Open Terminal by holding Shift while right-clicking

Set the directory Set your directory yourself, or just leave the default.

Connect your domain

Click the "Connect domain" button to start linking your domain to Firebase. You'll need a domain you own.

Connect domain Click the "Connect domain" button

Hosting setup (1) Type your domain and prove ownership by adding a TXT record at your DNS provider.

In my case, my DNS provider is GoDaddy, so I added the TXT record there.

Change TXT value Type is TXT, host is your domain, and copy-paste the value into the TXT field.

Change A value Next you'll get one or more "A" records-add them at your DNS provider the same way.

Changed A value Updated "A" values at GoDaddy

Upload your files

Move your assets into the directory you set up in Terminal. In my case, the public directory is public (the default). Then, in Terminal, run the deploy command.

Create a new project Run this command…

Create a new project Files uploading… Done!

Get HTTPS

That's it. Now wait 5 minutes to 2 hours for Firebase to apply your domain settings. Until then, you may see a warning when visiting your domain:

Changed A value Like this!

I went through this process for my own portfolio site because I didn't want visitors to be greeted by a "Not secure" warning in Chrome. After about 30 minutes:

'http' to 'https' Finally!

Certificate Certificate for spemer.com

Hope this helps, especially for people new to the deployment side of things. Thanks!

Title : Connecting your domain using Google Firebase (with Node.js)
Date : May 19, 2017
Writer : Hyouk Seo (Spemer)