I started working on a Firebase Hosting project to host my custom, so not via the deprecated Firebase links, association files and assetlinks json. The solution I had in mind included the following firebase.json configuration:
{
"hosting": {
"public": "public",
"appAssociation": "NONE",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [{
"source": "/redirect",
"destination": "https://custom-redirect.com",
"type": 301
}],
"rewrites": [{
"source": "/apple-app-site-association",
"destination": "ios.json"
}, {
"source": "/.well-known/assetlinks.json",
"destination": "android.json"
}, {
"source": "**",
"destination": "index.html"
}]
}
}
This works as expected when using the firebase serve
command, and allows me to access the urls as expected. When using the firebase deploy
command it however results in a 404 error when using an url that does not exists (whereas in the local environment this would be rewritten to the index.html) or when the associated link domains are used. If I add another rewrite rule, as follows:
{
"source": "/test",
"destination": "ios.json"
}
I see the same behaviour, working locally but leading to a 404 in the deployed environment.