How to turn off default domain in firebase hosting - firebase

六眼飞鱼酱① 提交于 2020-05-15 21:22:11

问题


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...


回答1:


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):

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 === "example.web.app" || 
    window.location.hostname === "example.firebaseapp.com") {
       window.location.href = 'https://example.com'; 
}


来源:https://stackoverflow.com/questions/61396081/how-to-turn-off-default-domain-in-firebase-hosting-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!