I'm using Firebase Hosting to host a website and I'm using a custom domain name. I want my website to be the destination for let's say: https://example.com
I also use firebase dynamic links that uses the same domain but using a different prefix.
Like this: https://links.example.com
The website host and dynamic links are working fine, but the problem is I don't know how to write my firebase.json rewrites in a way that allows for both the site (example.com) to work and the subdomain (links.firebase.com) that I can use for my dynamic links.
The dynamic links work if I use the following rewrite:
"rewrites": [
{
"source": "/**",
"dynamicLinks": true
}
]
But this way the main website (example.com) display a message about not being a valid dynamic link, in stead of showing the index.html
TL/DR I'm wondering if it is possible to have both the website (example.com) and the dynamic links (links.example.com) working on the same domain (example) ?
Thanks in advance
EDIT 1: I had renamed the index.html so that's why I wasn't seeing the website. Now that I changed it back it works, but the dynamic links do not. links.example.com shows the index.html
EDIT 2: It finally works as intented: example.com and links.example.com point to the index.html while any format like links.example.com/aShortDynamicLinkCode activates dynamic links.
I used the following rewrites in my Firebase.json to achieve this
{
"source": "**",
"dynamicLinks": true
},
{
"source": "/**",
"dynamicLinks": true
},
If you have an index.html
in your public
directory, it will serve at /
even if you have a rewrite like you specify (see serving priority in the docs).
If you're not seeing your index.html
, that indicates that something is probably misconfigured. Double-check that your index.html
is in the root of your public
directory and that the number of files being deployed seems accurate.