google-cloud-platformgoogle-cloud-load-balancer

Serving react app via Google Cloud Storage and loadbalancer, mapping any urls to index?


I'm setting up React app frontend with Google Cloud Storage and Loadbalancer. During build, index.html and javascript file is uploaded into cloud storage. Loadbalancer points to backend bucket. I can now access react app if I go to http://(loadbalancerip)/index.html

I want to react to handle all routing, and I also want our user to access site via arbitrary path (eg http://(loadbalancerip)/user/details). Is there a way to achieve this with GCP load balancer? Basically I want it to always serve "index.html" regardless of path user is accessing.


Solution

  • I confirmed with GCP support that unfortunately it's not supported. Here is a open feature request https://issuetracker.google.com/issues/194125076