[GH-ISSUE #4928] [Feature]: load balancer for multiple servers #3450

Open
opened 2026-10-31 20:32:30 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Maybeoff on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4928

load balancer for multiple servers

Describe the solution you'd like

Make it possible to specify multiple servers in the load balancer and make it so that when connecting to a server, the user connects to the server from the load balancer so that other servers are not heavily loaded

Alternatives you've considered

I tried to understand how the existing balancer works and I couldn't figure it out because you can't specify nodes there and you can't select it as an inbound user

Concrete use case

For example, there are 2 nodes in 1 country and you need to distribute several users across these nodes so that both work approximately equally

Mockups, screenshots, or examples

Well, a new balancer is created and several nodes (servers) are selected there after connecting to the balancer's inbound, and from there the balancer sends traffic to servers with different workloads.

Which parts of the panel would this affect?

Other, Xray config generation

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @Maybeoff on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4928 ### Is your feature request related to a problem? load balancer for multiple servers ### Describe the solution you'd like Make it possible to specify multiple servers in the load balancer and make it so that when connecting to a server, the user connects to the server from the load balancer so that other servers are not heavily loaded ### Alternatives you've considered I tried to understand how the existing balancer works and I couldn't figure it out because you can't specify nodes there and you can't select it as an inbound user ### Concrete use case For example, there are 2 nodes in 1 country and you need to distribute several users across these nodes so that both work approximately equally ### Mockups, screenshots, or examples Well, a new balancer is created and several nodes (servers) are selected there after connecting to the balancer's inbound, and from there the balancer sends traffic to servers with different workloads. ### Which parts of the panel would this affect? Other, Xray config generation ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 4, 2026):

Thanks for the detailed request, @Maybeoff!

How the existing balancer works

The balancer in Xray Configs → Balancers operates at the outbound level: its selector field matches the tags of outbound entries, not 3x-ui nodes/servers. A routing rule then links an inbound tag to a balancer tag, so all traffic arriving on that inbound gets distributed across the selected outbounds.

This use-case is already possible — here is the manual workflow

You can achieve cross-server load balancing today using the existing panel, without any new code:

1. Set up forwarding outbounds on the entry node

In Xray Configs → Outbounds, add one outbound per backend server. Use the protocol your backend servers speak (e.g. VLESS, Trojan, Shadowsocks). Give each a distinct tag, for example:

  • node-ru-1 → points to server A (IP/port/credentials for that server's inbound)
  • node-ru-2 → points to server B

2. Create a balancer

In Xray Configs → Balancers, click + Balancers and:

  • Tag: e.g. balancer-ru
  • Selector: add node-ru-1 and node-ru-2 (or a shared tag prefix so the selector matches both)
  • Strategy: roundRobin (equal distribution) or leastLoad / leastPing (traffic-aware)
  • If you use leastLoad or leastPing, the panel automatically writes the observatory / burstObservatory config that probes those outbounds

3. Add a routing rule

In Xray Configs → Routing, add a rule:

  • Inbound Tag: the tag of the inbound your users connect to (e.g. inbound-entry)
  • Balancer Tag: balancer-ru
  • Leave Outbound Tag empty — when a balancerTag is set, Xray ignores outboundTag

4. Create the user-facing inbound

In the regular Inbounds panel, create an inbound on the entry server (any protocol). Users connect to this; Xray routes it through the balancer to one of the backend servers.

What is genuinely missing / the feature gap

The above works but requires entirely manual outbound + balancer + rule configuration. What does not exist yet is:

  • An integrated "multi-node balancer" workflow that lets you pick 3x-ui-managed nodes from a list and automatically generates the corresponding outbounds, balancer, and routing rule.
  • Health-check probing that is aware of 3x-ui node status (the observatory probes the outbound path, not the 3x-ui node registration).

That integrated workflow is the genuine new feature here, and would be a meaningful improvement over the current manual approach. If you or someone else wants to open a PR for it, the relevant files are:

  • frontend/src/pages/xray/balancers/BalancersTab.tsx / BalancerFormModal.tsx — balancer UI
  • frontend/src/pages/xray/outbounds/OutboundsTab.tsx — outbound UI
  • frontend/src/pages/xray/routing/RuleFormModal.tsx — routing rule UI

In the meantime, the manual workflow above should solve your immediate "2 nodes in 1 country, equal distribution" case.

<!-- gh-comment-id:4626250691 --> @github-actions[bot] commented on GitHub (Jun 4, 2026): Thanks for the detailed request, @Maybeoff\! ## How the existing balancer works The balancer in **Xray Configs → Balancers** operates at the **outbound** level: its `selector` field matches the tags of outbound entries, not 3x-ui nodes/servers. A routing rule then links an inbound tag to a balancer tag, so all traffic arriving on that inbound gets distributed across the selected outbounds. ## This use-case is already possible — here is the manual workflow You can achieve cross-server load balancing today using the existing panel, without any new code: ### 1. Set up forwarding outbounds on the entry node In **Xray Configs → Outbounds**, add one outbound per backend server. Use the protocol your backend servers speak (e.g. VLESS, Trojan, Shadowsocks). Give each a distinct tag, for example: - `node-ru-1` → points to server A (IP/port/credentials for that server's inbound) - `node-ru-2` → points to server B ### 2. Create a balancer In **Xray Configs → Balancers**, click **+ Balancers** and: - **Tag**: e.g. `balancer-ru` - **Selector**: add `node-ru-1` and `node-ru-2` (or a shared tag prefix so the selector matches both) - **Strategy**: `roundRobin` (equal distribution) or `leastLoad` / `leastPing` (traffic-aware) - If you use `leastLoad` or `leastPing`, the panel automatically writes the observatory / burstObservatory config that probes those outbounds ### 3. Add a routing rule In **Xray Configs → Routing**, add a rule: - **Inbound Tag**: the tag of the inbound your users connect to (e.g. `inbound-entry`) - **Balancer Tag**: `balancer-ru` - Leave `Outbound Tag` empty — when a `balancerTag` is set, Xray ignores `outboundTag` ### 4. Create the user-facing inbound In the regular **Inbounds** panel, create an inbound on the entry server (any protocol). Users connect to this; Xray routes it through the balancer to one of the backend servers. ## What is genuinely missing / the feature gap The above works but requires entirely manual outbound + balancer + rule configuration. What does **not** exist yet is: - An integrated **"multi-node balancer" workflow** that lets you pick 3x-ui-managed nodes from a list and automatically generates the corresponding outbounds, balancer, and routing rule. - Health-check probing that is aware of 3x-ui node status (the observatory probes the outbound path, not the 3x-ui node registration). That integrated workflow is the genuine new feature here, and would be a meaningful improvement over the current manual approach. If you or someone else wants to open a PR for it, the relevant files are: - `frontend/src/pages/xray/balancers/BalancersTab.tsx` / `BalancerFormModal.tsx` — balancer UI - `frontend/src/pages/xray/outbounds/OutboundsTab.tsx` — outbound UI - `frontend/src/pages/xray/routing/RuleFormModal.tsx` — routing rule UI In the meantime, the manual workflow above should solve your immediate "2 nodes in 1 country, equal distribution" case.
Author
Owner

@rqzbeh commented on GitHub (Jun 9, 2026):

there is no such a feature in xray-core itself, you can use haproxy or cdn based balancers.
or use clients that offers such a service, like Karing or Hiddify client that comes with Balancer

<!-- gh-comment-id:4658873210 --> @rqzbeh commented on GitHub (Jun 9, 2026): there is no such a feature in xray-core itself, you can use haproxy or cdn based balancers. or use clients that offers such a service, like Karing or Hiddify client that comes with Balancer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3450
No description provided.