Search code examples
google-app-enginegoogle-cloud-platformgoogle-cloud-storagegoogle-cloud-endpoints

How can I get my react app in cloud storage and app engine api to be under the same domain?


I have recently moved to GCP for cloud hosting. I have a react app hosted in cloud storage and a Go REST api hosted on app engine. I am trying to figure out how I can use the same domain name for both of these.

For example:

www.mydomain.com/
www.mydomain.com/api/v1/*

Coming from an AWS background, it would be something like this:

enter image description here

I have tried searching many hours for a solution, but have no luck solving this. Any advice / help is greatly appreciated.


Solution

  • Yes, you can do this with a load balancer. You can set up a URL map to match the desired paths, and point different requests to the backend bucket and app engine, respectively.

    For HTTPS load balancing, the target HTTPS proxy uses SSL certificates. It uses a URL map to make a routing. Based on the routing, the proxy forwards requests to specific backend services or backend buckets. The URL map can specify additional actions, such as pointing to a NEG (network endpoint group- that specifies a group of backend endpoints for a load balancer) which in turn points to a Cloud Run, App Engine, or Cloud Functions service.

    We are using the same concept to point the load balancer with the help of a URL map to backend Cloud Storage buckets where you have the React App and to a NEG service, a REST Golang API hosted on App Engine.