Firebase 动态链接子域配置

coc*_*ave 7 firebase firebase-hosting firebase-dynamic-links

假设我有一个域example.com。我通过托管和 cli 创建了第二个网站sub.example.com

{
  "hosting": [
    {
      "target": "app",
      "public": "public",
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "promos",
      "public": "public",
      "appAssociation": "AUTO",
      "rewrites": [
        {
          "source": "**",
          "dynamicLinks": true
        }
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

现在,当我在sub.example.com没有任何路径前缀的情况下创建动态链接时,它给了我一个危险信号:

It looks like you already have content served on this path. Specify a different path prefix to avoid conflicts with existing content.
Run Code Online (Sandbox Code Playgroud)
  1. 我究竟做错了什么?
  2. 另外,如果这个子域仅用于链接,我还需要放置public字段吗?我不想在上面显示任何内容,只是链接...

coc*_*ave 11

我通过添加(或更确切地说忽略)动态链接子域的公共文件夹来修复它。

"ignore": [
    "*"
  ],
Run Code Online (Sandbox Code Playgroud)

我看到了这篇文章:https : //github.com/firebase/firebase-tools/issues/566,有人问了类似的功能问题,答案是删除dist/index.html. 但是由于我的实际站点依赖于它,我尝试忽略它并且它似乎有效。


fat*_*han 6

我用@cocacrave 的答案解决了同样的问题。只是分享完整的firebase.json文件。* 应该有一个公用文件夹和设置,但我的公用文件夹是空的。

{
  "hosting": {
    "public": "public",
    "ignore": [
      "*"
    ],
    "appAssociation": "AUTO",
    "rewrites": [
      {
        "source": "/**",
        "dynamicLinks": true
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)