question

Load balancer - traffic distribution between containers according to URL.

Hi!

How can I route traffic based on URL?

For example:

https://<my_domain>/ - goes to one container

https://<my_domain>/<path1> - goes to a second container

https://<my_domain>/<path2> - goes to another container

Thanks!

avatar
7
  • Hey Ruslan,

    You can do this by creating load balancer routes and utilizing path matches plus redirects.

    Environment -> Services -> Manage (next to Load Balancer) -> Controllers -> Port 443 -> Config -> Routers.

    When you create your routes, remember that order matters -- first match wins. The most specific path will need to be at the start.

    I believe Chris or Alex is working on a guide for this in our documentation.

    avatar
    platform
  • Hi Jake!

    Am I correct in understanding that when assigning a container in the LB, the LINKED record in DNS does not matter? Is it possible to use any logical operators, such as &&, ||, or !, in URL definitions? Does the URL need to be exact, or will the rule apply to all nested URLs as well?

    avatar
  • Hi,
    I navigated to Environment -> Services -> Manage (next to Load Balancer) -> Controllers -> Port 443 -> Config -> Routers, but I don’t see any options for configuring URL-based routing there. Deployment has been completed with two servers and three containers, each running two instances for high availability. The container pointed to by the LINKED record is working.

    avatar
  • No LINKED Records. Containers are only resolvable via HTTP/S over the public internet when they have a LINKED record.

    avatar
  • Hi Ruslan,

    Correct, Linked records help teach the load balancer how traffic is routed.

    On the routers, do you see a field named "Path Match" ?

    avatar
    platform
  • Yes, I have three containers, each with two instances: home, awards, and youtube.

    I ended up creating three LINKED records, one for each, as otherwise, it resulted in an error.

    Each container has its own path:

    home - / awards - /awards youtube - /youtube I configured the Load Balancer settings under the Config section for each container according to its path and for port 443.

    However, it’s unclear what is meant by "Match Internal Port(s)" since I already defined port mapping during the container deployment.

    Also, access to the containers (except for home) via their network addresses is not working.

    avatar
v2024.12.08.01 © 2024 Petrichor Holdings, Inc.