0

I have a project that has routes and paths defined in a load balancer. Now I want to add a google cloud run container to that project. Do I need to make another load balancer, or can I add the paths to the current load balancer?

how would I add a path to the cloud run container path? (for either scenario)

like mydomain.com/"new-path/container"/"path-of-new-path"

like in load balancer paths:

/newPath/newPath/*

or /newPath

and then the container (express.js in my case) dicates the newPath -paths?

confused. Also now to add confusion to the matter. can i have two ports?

like: mydomain.com:443/newPath:8080

Teoman Kirac
  • 748
  • 3
  • 8
  • 16

1 Answers1

3

There is many possible configuration. You can route the traffic on

  • The domain
  • The path prefix
  • A combination of both.

With Serverless NEG, you also have in addition an URL mask that you can use to route the traffic through different serverless services

If your service doesn't support the load balancer path, you can also use a rewrite rule to remove that additional path level and clean the API call to your service

Finally, about the port, it's independent: the frontend ports doesn't influence the path resolution for request routing. But the domain does.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • hmm ok well i need my port on the path to be 8080 for socket.io. Can I change my main domain port to that as well? is that advised. i can't change the port on the existing load balancer from 443 – Teoman Kirac Apr 07 '22 at 13:58
  • @TeomanKirac - what is port 8080 for? Your question states a bucket and Cloud Run. Cloud Run only supports ports 80 and 443 (80 will redirect to 443). – John Hanley Apr 08 '22 at 03:13
  • @JohnHanley, I understood that's the configuration of the HTTPS load balancer front end. However, I think you can't configure URL map on the port, only domain and path. – guillaume blaquiere Apr 08 '22 at 10:16
  • @guillaumeblaquiere - you are correct. I was trying to help the OP clarify what he needs to accomplish. This line will not work for Cloud Run no matter which load balancer he selects **mydomain.com:443/newPath:8080**. – John Hanley Apr 08 '22 at 18:32