在我的例子中,我有三个不同的域
https://www.bilal.ai (bilal.ai) <---- for showcase website firebase hosting
https://app.bilal.ai <---- for the web app
https://api.bilal.ai <---- for firebase functions我所做的:
1)我已经通过this document了,我已经连接了我的web应用程序和一些云功能,比如注册功能,通过在我的firebase仪表板中重写托管方法,app.bilal.ai工作得很好,注册功能也很好。
问题
1)第一个域和展示网站是一个完全不同的项目,它是在一个不同的平台上,但我希望他们都在同一个项目中,如果可能的话
2)到目前为止,我已经看到了连接自定义域名到firebase主机和功能的文档,我已经确定连接了它,但这两个域名都在做同样的事情,这是一个问题,例如,当我转到app.bilal.ai时,它显示了应用程序,当我转到api.bilal.ai时,它也显示了错误的web应用程序,我想要这个域名专门用于后端apis,这是firebase功能,例如登录注册功能
3)类似地,当有人调用api.bilal.ai/login时,它使用登录函数工作,但如果通过app.bilal.ai/login调用相同的api,它也工作,这是错误的,我希望这显示错误
4)通过重写方法,我必须将每个函数分别写在firebase.json文件中,我需要一些**东西来连接所有函数和自定义域,这个问题也是在comment here中提出的
发布于 2020-02-06 15:37:46
如果你在使用Blaze计划,你可以试试Firebase multisite hosting。
从文档中:
添加域后,应用目标:
firebase target:apply hosting blog bilal-website
firebase target:apply hosting app bilal-api定义托管配置:
{
"hosting": [ {
"target": "website", // "blog" is the applied target name for the Hosting site "myapp-blog"
"public": "website/dist", // contents of this folder are deployed to the site "myapp-blog"
// ...
},
{
"target": "api", // "app" is the applied target name for the Hosting site "myapp-app"
"public": "api/dist", // contents of this folder are deployed to the site "myapp-app"
// ...
"rewrites": [...] // You can define specific Hosting configurations for each site
}
]
}https://stackoverflow.com/questions/60088269
复制相似问题