22

I am hosting a site on Firebase hosting. It has a default URL of myapp.firebaseapp.com. I have configured a custom URL for my app and it is sub.domain.com. The issue i am having is that both are still accessible. Users can access the app from myapp.firebaseapp.com and sub.domain.com. I need users to only be able to access sub.domain.com.

Is there a way to turn off the default domain within the Firebase console or do i need to accomplish this with a rewrite or a redirect?

Any help would be greatly appreciated. I searched around and was not able to find any information regarding this issue. Below is a screenshot showing that both domains are configured correctly.

enter image description here

Cody M.
  • 275
  • 2
  • 10
  • Found this link but this seems to only address links going to your app https://stackoverflow.com/questions/34212039/redirect-to-firebase-hosting-custom-domain – Cody M. Oct 04 '17 at 14:50

2 Answers2

0

I think your only option (at least for now) is to use to redirect the users. You could redirect your users from default to the custom url using simple Javascript. That could be done by getting the host (window.host), checking if it is the default or the custom url and redirecting if necessary.

Filip Sakel
  • 315
  • 4
  • 8
0

Your default domain could not be turned off. The only option is not make it public at the moment.

Or you can tweak a cloud function that will redirect your functions to new custom domain.

HexaCrop
  • 3,863
  • 2
  • 23
  • 50