I'm looking for a way to configure a redirection in Firebase so that the "pretty" url like https://customdomainname.com/story/asdf
is redirected to the real path in Firebase which is generated like https://firebasestorage.googleapis.com/v0/b/myprojectname-12345.appspot.com/o/stories%2Fasdf.m4a?alt=media&token=574e6dee-f289-468d-99ad-6e5d2ac8d6aa
. For doing that I have connected a custom domain to firebase so that now I see both the default domain and the custom connected domain (probably I have been already mistaken at this step). I have installed the Firebase console, initialized a project with firebase init
and following this instruction I have put this to the generated firebase.json
:
{
"hosting": {
"public": "public",
"redirects": [{
"source": "/story/:namepart",
"destination": "https://firebasestorage.googleapis.com/v0/b/projectname-12345.appspot.com/o/stories%2F:namepart.m4a?alt=media&token=574e6dee-f289-468d-99ad-6e5d2ac8d6aa",
"type": 301
}]
}
}
where :namepart
is assumed to be a wildcard parameter. And I have deployed the project with no files but with this configuration. And it doesn't work as expected. Probably I'm misunderstanding the usage of wildcards, I'm not sure they can be interpolated into a string like that. If they can't, could anyone suggest another approach to achieve such redirection? Many thanks!
来源:https://stackoverflow.com/questions/44852804/is-it-possible-to-configure-redirection-with-wildcard-for-firebase-hosting-so-th