smarkue
smarkue

Reputation: 21

Firebase Hosting rewrite path to use GCP API Gateway as backend for SPA

I am trying to find a way to connect the backend (GCP API Gateway) to our Angular app hosted on firebase.

The goal is to route requests on myapp.com/api to the API Gateway. All other routes should server our SPA.

I know there is a possibility to create explicit rewrite rules for Cloud Functions and Cloud Run. But couldn't find a way to connect to an api gateway.

The only solution that might work is to setup an Global Load Balancer that handles the routing and connect the IP Address of the Firebase Hosting as an external NEG.

Is there a simple way to connect a Firebase hosted app to an GCP API Gateway?

Upvotes: 2

Views: 377

Answers (1)

kostasandre
kostasandre

Reputation: 83

Hello i have implemented it like this. The only problem i am facing write now is that Authorization Bearer token seems that is not passed to the gateway:

{
  "redirects": [
    {
      "source": "/my-api/**",
      "destination": "url of your gateway",
      "type": 301
    }
  ]
}

Upvotes: 0

Related Questions