Search code examples
node.jsfirebasefirebase-hosting

firebase rewrites sub-domains


at first I have to paths one for API ans second for regular website, so I want separate the API as subdomain like that

    "rewrites":[
  {
    "source":"domain.com/**",
    "destination":"/index.html"
  },
  {
    "source": "api.domain.com/**",
    "function": "app"
  }
]

I have tried many ways but all failed , How can I do it ?


Solution

  • While it is possible to have multiple subdomains in a single Firebase Hosting project, it is not configured through rewrites in firebase.json. You'll instead need to set up the subdomains in the Firebase console, and then configure them through the Firebase CLI. For a full walkthrough of the steps, have a look at the documentation for multi-site setup.