【问题标题】:firebase custom domain name dynamic links not workingfirebase自定义域名动态链接不起作用
【发布时间】:2020-10-31 06:26:39
【问题描述】:

我正在使用 Firebase 托管。我有 index.html 文件。

它通过 Firebase URL 和自定义域打开。

如果有人尝试打开 example.com 它应该打开 index.html

但如果有人尝试打开example.com/?link=https://google.com,它应该在链接参数中动态打开 URL。

我不知道我做错了什么。即使存在链接参数。它仍然会打开 index.html 文件。

这是我的 firebase.json

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
"appAssociation": "AUTO",
"rewrites": [
  {
    "source": "/?link**",
    "dynamicLinks": true
  },
  {
    "source": "!/?link**",
    "destination": "/index.html"
  }
]
  }
}

【问题讨论】:

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


    【解决方案1】:

    您应该删除 index.html 的重写规则

    {
      "source": "!/?link**",
      "destination": "/index.html"
    }
    

    并删除 dynamicLinks 重写规则源上的 ?。它应该是这样的。

    {
      "hosting": {
        "public": "public",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "appAssociation": "AUTO",
        "rewrites": [{
          "source": "/link**",
          "dynamicLinks": true
        }]
      }
    }
    

    再次部署更改,这应该将https://example.com/link 设置为您的动态链接域。您可以通过在域上手动添加 FDL 参数来测试 FDL 域是否正常工作。

    https://example.com/link?link=https://google.com

    【讨论】:

    • 我删除了这个,仍然没有重定向动态链接。
    • 谢谢。看起来我错过了dynamicLinks 源上的? 集。这也应该被删除。
    • 感谢奥马特。我可以像这样进行多少次重定向?是无限的还是什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 2019-04-10
    相关资源
    最近更新 更多