使用自定义域进行 firebase 函数 http 调用 [英] Use custom domain for firebase function http calls
问题描述
有没有办法为 firebase 云函数 http 钩子使用自定义域.
Is there a way to use a custom domain for firebase cloud functions http hooks.
云函数的默认网址如下所示:
The default url for cloud functions looks something like this:
https://us-central1-my-awesome-app.cloudfunctions.net/ios-oauth/
还有
我想让它看起来像这样:
I would like to make it look like this:
https://myawesomeapp.com/ios-oauth/
我环顾四周是否有其他人在寻找相同的解决方案,果然我找到了:
I looked around if there was some other people looking for the same solution and sure enough I found this:
https://stackoverflow.com/questions/43482224/firebase-cloud-功能自定义域
推荐答案
我已经联系了 Firebase 支持以获得有关此问题的一些答案.我在文档中被转发到这部分.
I have contacted firebase support to get some answers about this. And I was forwarded to this part in the documentation.
https://firebase.google.com/docs/hosting/functions#create_an_http_function_to_your_hosting_site
您可以将自己的域与 firebase-cloud-functions 结合使用.方法是使用 firebase-hosting.
You can use your own domain with the firebase-cloud-functions. The way to do is is using the firebase-hosting.
- 将自定义域连接到 Firebase 托管
向 firebase.json 添加自定义函数路由
- Connect custom domain to firebase hosting
Add custom function routing to firebase.json
{
"hosting": {
"public": "public",
// Add the following rewrites section *within* "hosting"
"rewrites": [{
"source": "/bigben", "function": "bigben"
}]
}
}
部署到 Firebase
Deploy to firebase
这篇关于使用自定义域进行 firebase 函数 http 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!