2

I have a VM that has 3 applications hosted on it. All the apps are working fine with the VM's public IP and port (e.g. 34.44.55.66:{port})

  1. React JS website 1 (port 3001)
  2. React JS website 2 (port 3002)
  3. Express JS API 1 (port 3003)

I now want to have all these behind a Cloud Load Balancer. I've done the following for it.

  • Created three backend services (one for each application)
  • Created Host and Path rules as below enter image description here

The load balancer is created without any issues. However, only the default path works fine. Refer to the details below (consider the LB IP as 55.66.77.88).

  • 55.66.77.88: Website-1 opens without any issue (default path)

  • 55.66.77.88/website-1: Website-1 shows error messages in the browser console enter image description here

  • 55.66.77.88/website-2: Website-2 shows error messages in the browser console enter image description here

  • 55.66.77.88/api-1: API-1 shows an error message in the browser console

    GET http://55.66.77.88/api-1 404 (Not Found)

Whenever I map any of the above backend services with the default path, they work fine. However, they do not work as expected when the path is entered in the browser.

Any advice will be appreciated.

Sahil Khanna
  • 121
  • 2

1 Answers1

2

Looking by the error 404, I guess the server is reached, but the paths like /website-1/bundle.js may not be mapped to appropriate resources. But your server seems to be responding to /bundle.js kind of paths since they may be mapped. So basically try to map these paths on your web server so that your website can be served from /website-1/ or /website-2/ paths as well.