Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off default domain in firebase hosting - firebase

I just set up new Firebase Hosting and my custom domain and my web page, etc...

Everything works great, except what is really bothering me are default Domains:

  • projectname.web.app
  • projectname.firebaseapp.com

Looking around googling, I have not found a solution, how to remove or disable them... Any suggestion? This seems really annoying. It could be a show stopper for me...

like image 437
5er Avatar asked Apr 23 '20 20:04

5er


People also ask

How do I add a custom domain to my Firebase project?

Make sure that you've completed the "Get Started" wizard from your project's Firebase Hosting pageso that you have a Firebase Hosting site in your Firebase project. Step 1: Add domain From your project's Hosting page, enter the wizard for connecting a custom domain: If you have only one Hosting site, click Connect domain.

How do I Turn Off Firebase Hosting?

Run firebase hosting:disable through the firebase-tools CLI first. Go to Firebase Console and select Hosting from the menu of the left. You will see the deployed project with a list of your historical actions like Deployed, disabled, etc.

What are the firebase subdomain options?

For serving your content, Firebase offers several domain and subdomain options: By default, every Firebase project has free subdomains on the web.app and firebaseapp.com domains. These two sites serve the same deployed content and configuration.

How to delete a deployment in Firebase?

Go to Firebase Console and select Hosting from the menu of the left. You will see the deployed project with a list of your historical actions like Deployed, disabled, etc. Only after you have disabled the site, the "three vertical dots" menu will be available for you to choose the action to delete the deployment.


1 Answers

I have contacted Firebase Hosting help. According to them, you can not disable, remove, hide or make them private. Meaning they will always be there and be accessible to the public...

Their official answer;

  • what you can do is to add in the header (suggested by Firebase Hosting):
<link rel="canonical" href="http://myapp.domain.com/" />

However, this did not work for me out of the box. I asked Google to re-index my web page (still waiting at this point to re-index).

  • another approach (also suggested by Firebase Hosting), redirect:
//check if the url
if (window.location.hostname == "yourapp.web.app" || 
    window.location.hostname == "yourapp.firebaseapp.com") {
       window.location.href = 'http://yourcustomdomain'; 
}
like image 167
5er Avatar answered Sep 18 '22 03:09

5er