Firebase自定义域名动态链接不起作用

时间:2020-10-31 06:26:39

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

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

通过Firebase URL和“自定义域”同时打开。

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

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

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

这是我的firebase.json

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

1 个答案:

答案 0 :(得分: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