Reputation: 5866
I'm using Firebase Dynamic Links to redirect users to mobile app.
Links like https://example.com/mypath
works, but I also want to use root url, i.e. https://example.com
Currently it shows error:
Invalid Dynamic Link
Requested URL (https://example.com/) must be a parsable and complete DynamicLink.
If you are the developer of this app, ensure that your Dynamic Links domain is correctly configured and that the path component of this URL is valid.
When I try to set up a link without prefix, it shows error:
Short URL is required
Is it any way to set up root url?
Upvotes: 16
Views: 36787
Reputation: 1
Requested URL must be a parseable URI, but possibly incomplete to be a DynamicLink.
If you are the developer of this app, ensure that your Dynamic Links domain is correctly configured and that the path component of this URL is valid.
Upvotes: -2
Reputation: 6173
As an Android user, I had sort of same issue, I did manage to get this sorted finally, just in case someone else has the same issue as mine I put what I did:
so if you getting the same issue, which is by typing following in your browser and you do not see any data, then this means your Firebase project is not fully registered with the sha256 key.
https://YOURLINK.page.link/.well-known/assetlinks.json
In my case, I had to add a new sha256 key to my firebase project, apparently for dynamic links to work Firebase project MUST be signed with the sha256.
This official firebase video should keep you going: https://youtu.be/zra2DCd0DnY
Upvotes: 0
Reputation: 31
Another way to set up a redirect from the root dynamic link domain (without serving a page with a javascript redirect) is by adding a redirect rule like this one to your firebase.json file:
"redirects": [ {
"source": "/",
"destination": "https://example.com/page-for-root-to-redirect-to",
"type": 301
} ]
This rule will exist alongside your dynamic link rewrite rule(s), so for a simple setup where all paths except the root are treated as dynamic links, your firebase.json might look like this:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "/**",
"dynamicLinks": true
} ],
"redirects": [ {
"source": "/",
"destination": "https://example.com/page-for-root-to-redirect-to",
"type": 301
} ]
}
}
To access and modify your firebase.json file, you'll have to set up firebase hosting with the Firebase CLI if you haven't already: https://firebase.google.com/docs/hosting
This page explains more about the firebase.json file and how to use rewrite and redirect rules: https://firebase.google.com/docs/hosting/full-config
Upvotes: 3
Reputation: 106
If you also happen to use Cloudflare, my solution to this problem was to add a subdomain to Firebase dynamic links and make the main url redirect to the subdomain using page rules.
This way, you can setup it up to work like this:
example.com/url
-redirect_to-> subdomain.example.com/url
(and load dynamic link)example.com/
-redirect_to-> main site or whatever you wantUpvotes: 1
Reputation: 57
I had this same problem. What I wanted to do is forward the root domain to a different URL. What I did was set up firebase hosting on that domain. Then on the index.html file, I wrote a javascript redirect.
<script>
window.location = "https://www.example.com";
</script>
If you need any more help, please feel free to reply to this and I will help you.
Upvotes: 0