Ava Juan
Ava Juan

Reputation: 113

firebase custom domain name dynamic links not working

I'm using firebase hosting. I have index.html file.

It's opening via Both Firebase URL and Custom Domain.

If anyone tries open example.com it should open index.html

But if anyone try to open example.com/?link=https://google.com it should dynamically open the URL in link parameter.

I don't know what I'm doing wrong. Even if the link parameter is present. It still opens the index.html file.

Here is my firebase.json

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

Upvotes: 0

Views: 707

Answers (1)

Omatt
Omatt

Reputation: 10559

You should remove the rewrite rule for index.html

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

and remove ? on the dynamicLinks rewrite rule source. It should look like this.

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

Deploy the changes again and this should set https://example.com/link as your Dynamic Link domain. You can test if the FDL domain functional by manually adding FDL parameters on the domain.

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

Upvotes: 1

Related Questions