【问题标题】:Firebase Dynamic Links subdomain configFirebase 动态链接子域配置
【发布时间】:2020-03-16 09:27:06
【问题描述】:

假设我有一个域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
        }
      ]
    }
  ]
}

现在,当我去为 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.
  1. 我做错了什么?
  2. 另外,如果这个子域只用于链接,我还需要输入public 字段吗?我不想在上面显示任何内容,只是链接...

【问题讨论】:

    标签: firebase firebase-hosting firebase-dynamic-links


    【解决方案1】:

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

    "ignore": [
        "*"
      ],
    

    我看到了这个帖子:https://github.com/firebase/firebase-tools/issues/566,有人问过类似的函数问题,答案是删除dist/index.html。但由于我的实际网站依赖于它,所以我尝试忽略它,它似乎可以工作。

    【讨论】:

    • 这听起来很奇怪。 “忽略”子句只是阻止某些本地文件在部署时上传。您只需将带有“dynamicLinks”的重写规则放在其他(更通用的)规则之前。
    【解决方案2】:

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

    {
      "hosting": {
        "public": "public",
        "ignore": [
          "*"
        ],
        "appAssociation": "AUTO",
        "rewrites": [
          {
            "source": "/**",
            "dynamicLinks": true
          }
        ]
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-11-14
      • 2020-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多