firebase - 如何使 Firebase 托管/api 重写对应用引擎服务的请求

标签 firebase firebase-hosting

目前我有以下 firebase.json。我想重写 https://myapp.firebaseapp.com/api 的所有请求指向https://myapp.appspot.com/api (我的应用引擎服务之一)。有点像 dispatch.yaml appengine 使用的那个,我该怎么做?我不想使用 DNS 和像 api.xxxx.com/api 这样的子域

{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "/api**",
        "destination": "https://myapp.appspot.com/api"
      },
      {
        "source": "!/api/**",
        "destination": "/index.html"
      }
    ]
  }
}

最佳答案

Firebase 托管不支持重写 Google App Engine 的路径。您的 rewrite options目前是:

  • Functions
  • Cloud Run container
  • Dynamic links
  • 关于firebase - 如何使 Firebase 托管/api 重写对应用引擎服务的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55657736/

    相关文章:

    dns - 如何在 Firebase 上创建自定义子域?

    java - Firebase 数据库异常无法将 long 转换为 String

    java - 从firebase数据库获取数据时如何解决数据覆盖问题

    ios - Firebase:当用户终止应用程序时如何从 Firebase 中清除特定数据?

    firebase - 实时数据库中有startBefore()函数吗?

    node.js - Node.js 应用程序的 firebase 部署命令导致错误 : `runtime` field is required but was not found in firebase. json

    Android:Firebase:Digits: 属性 io.fabric.ApiKey 也存在于 firebase-ui-auth

    javascript - 从 Firebase 托管到 Firebase 功能的请求被 CORS 阻止

    angular - Firebase 托管中 Angular 8 的 Mime 错误

    javascript - 使用 firebase 建站