firebase重写子域

Mah*_*poo 5 node.js firebase firebase-hosting

首先,我必须为 API 指定路径,为常规网站指定第二个路径,所以我想将 API 分离为子域,如下所示

    "rewrites":[
  {
    "source":"domain.com/**",
    "destination":"/index.html"
  },
  {
    "source": "api.domain.com/**",
    "function": "app"
  }
]
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法都失败了,我该怎么办?

Fra*_*len 8

虽然单个 Firebase 托管项目中可以有多个子域,但它不是通过在firebase.json. 您需要在 Firebase 控制台中设置子域,然后通过 Firebase CLI 进行配置。有关步骤的完整演练,请查看多站点设置文档