Is it possible to configure redirection with wildcard for Firebase hosting so that the wildcard parameter is interpolated into string?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 04:23:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!