将自定义域用于Firebase函数http调用 [英] Use custom domain for firebase function http calls

查看:80
本文介绍了将自定义域用于Firebase函数http调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将自定义域用于Firebase云功能http钩子.

Is there a way to use a custom domain for firebase cloud functions http hooks.

云函数的默认URL如下所示:

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-functions-custom-domain

推荐答案

我已与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.

  1. 将自定义域连接到Firebase托管
  2. 将自定义函数路由添加到firebase.json

  1. Connect custom domain to firebase hosting
  2. 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屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆