Use custom domain name as firebase database/auth/storage URL [duplicate]

元气小坏坏 提交于 2021-01-27 11:40:55

问题


Firebase use this pattern for its database and auth and storage URL

auth: https://[PROJECT_ID]. firebaseapp.com
database: https://[PROJECT_ID].firebaseio.com
storage: https://[PROJECT_ID]. appspot.com

I need to map these URLs to my custom domain like this

auth: https://fbauth. [MY_CUSTOM_DOMAIN].com
database: https://fbdb.[MY_CUSTOM_DOMAIN].com
storage: https://fbstorage. [MY_CUSTOM_DOMAIN].com

It will help to improve my website SEO because all request will be served from my domain

I googled it and found this link Serving an API from Your Domain Name but I'm looking for a straight-forward solution.

Could you please first let me know if I'm doing the right thing And second, let me know how I should do this


回答1:


There is no way to serve the Firebase Realtime Database from your own domain, without writing your own wrapper around it. It has been tried before, but to my knowledge nobody ever finished it. Also see Firebase custom domain name for database

The same applies to Cloud Storage for Firebase. If you want to control the domain it is served from, you'll have to implement a proxy/wrapper. That probably defeats the purpose of why you use Cloud Storage to begin with.

You can use a custom domain for the email verification flow for Firebase Authentication. But as far as I know there is no way to set up your custom domain for other authentication operations. So here too, a wrapper/proxy would be your only option. Also see: Add custom domain to be used with firebase real time database (i.e. verify email links), and Custom authDomain in Firebase (where Michael's answer sounds promising).



来源:https://stackoverflow.com/questions/54050225/use-custom-domain-name-as-firebase-database-auth-storage-url

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