mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4928] [Feature]: load balancer for multiple servers #3450
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3450
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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?
Before submitting
@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
selectorfield 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 B2. Create a balancer
In Xray Configs → Balancers, click + Balancers and:
balancer-runode-ru-1andnode-ru-2(or a shared tag prefix so the selector matches both)roundRobin(equal distribution) orleastLoad/leastPing(traffic-aware)leastLoadorleastPing, the panel automatically writes the observatory / burstObservatory config that probes those outbounds3. Add a routing rule
In Xray Configs → Routing, add a rule:
inbound-entry)balancer-ruOutbound Tagempty — when abalancerTagis set, Xray ignoresoutboundTag4. 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:
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 UIfrontend/src/pages/xray/outbounds/OutboundsTab.tsx— outbound UIfrontend/src/pages/xray/routing/RuleFormModal.tsx— routing rule UIIn the meantime, the manual workflow above should solve your immediate "2 nodes in 1 country, equal distribution" case.
@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