mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5095] [Feature]: Configurable Clash/Mihomo proxy groups for subscriptions with fallback/url-test support #3583
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#3583
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 @v0stok-p on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5095
Is your feature request related to a problem?
Yes.
3x-ui can already generate Clash/Mihomo YAML subscriptions with multiple proxies and a default
PROXYgroup, and recent releases added routing rules / enable-routing support for Clash subscriptions.However, the generated
proxy-groupssection is currently not configurable enough for client-side failover scenarios.For example, a generated subscription may look like this:
This works for manual selection, but it does not provide real priority-based failover.
The desired behavior is:
This is not the same as the existing Xray outbound balancer workflow. Xray balancer works on the entry node after the client has already connected to that node, which means the entry node becomes part of the data path. In this use case, the backup/control node must not relay all traffic during normal operation.
Describe the solution you'd like
Please add configurable Clash/Mihomo proxy group templates for generated YAML subscriptions.
The panel could allow admins to configure the generated
proxy-groupssection, at least for these group types:selectfallbackurl-testload-balanceSuggested UI placement:
or a dedicated section near the existing Clash/Mihomo routing settings.
Suggested options:
Group name
Example:
PROXY,AUTO,FALLBACKGroup type
Example:
select,fallback,url-test,load-balanceOrdered proxy list
The admin should be able to choose which generated nodes/inbounds are included and in what order.
Optional
DIRECTentryCheckbox: include
DIRECTin the group or not.Health-check options for
fallback/url-testExample fields:
The generated final rule should be able to use this group:
instead of always targeting a hardcoded
PROXYgroup.Expected generated YAML example:
Expected behavior:
AMS-01first.AMS-01fails health checks or becomes unreachable, Clash/Mihomo switches toRU-01.AMS-01becomes healthy again, Clash/Mihomo switches back to it.Alternatives you've considered
Current generated
type: selectgroupThis requires manual switching and does not provide automatic failover.
Xray outbound balancer
This is not suitable for this use case because users connect to the entry node first, and then the entry node forwards traffic to backend nodes. That makes the entry node part of the normal data path, which is exactly what I want to avoid.
Inbound fallbacks
Xray inbound fallbacks are useful for protocol/SNI/path fallback after a connection reaches the server, but they do not solve client-side endpoint failover when the primary server is unreachable.
External subscription converters
This works, but moves subscription logic outside 3x-ui, makes deployments more complex, and breaks the idea of 3x-ui being the single source of truth for clients, nodes, subscription links, and generated configs.
Manually editing YAML after subscription import
This works only temporarily. The changes are lost or need to be repeated after subscription updates.
Concrete use case
I manage a main 3x-ui panel on
RU-01.RU-01acts as:There is also a remote node:
Clients fetch their Clash/Mihomo subscriptions from
RU-01, but during normal operation they should connect directly toAMS-01.Normal data path:
If
AMS-01is down, unreachable, or blocked from the client network, the client should automatically fail over toRU-01.Failover data path:
So
RU-01should only be used as a backup ingress path when the direct connection toAMS-01fails health checks.The undesired normal behavior is:
because that makes
RU-01part of the normal data path and consumes traffic on the control/backup node all the time.This is why the current Xray balancer model is not suitable for this use case. Xray outbound balancing works after the client has already connected to the entry node. In my scenario, the client should normally bypass the entry/control node entirely and connect to
AMS-01directly.This request is specifically about client-side Clash/Mihomo failover in generated subscriptions:
Mockups, screenshots, or examples
Current generated behavior:
Requested generated behavior:
Possible UI idea:
Which parts of the panel would this affect?
Frontend (UI / panel pages), Subscription (share links / Clash / JSON), Backend (API endpoints, login, settings), Xray config generation
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 8, 2026):
Thanks for the detailed write-up and concrete use case.
What exists today
The routing merge machinery in
sub/subClashService.go(mergeClashRulesYAML, line 563) already handles arbitrary top-level YAML keys. When Clash/Mihomo routing is enabled and the Clash/Mihomo Rules field contains a full YAML map, any key that is notrules— includingproxy-groups— is set directly in the output config, overriding the generated default. So a partial workaround is possible right now:Settings → Subscription → Clash/Mihomo:
Because
mergeClashRulesYAMLseesproxy-groupsas a non-ruleskey, it doesbase["proxy-groups"] = value, replacing the defaultPROXY / selectgroup entirely. TheMATCH,AUTOrule is recognized as a terminal MATCH rule (seehasClashMatchRule,subClashService.go:633), so it replaces rather than prepends.The limitation this workaround has
The proxy names in
proxies:must be exact string matches for the remark names that the panel generates from your inbounds. There is no template variable like{{all-proxies}}or{{proxy-1}}. If remark names change, the YAML must be updated manually.What this feature request adds
The core ask is dynamic proxy name injection: the panel should automatically populate the
proxieslist of a configured group from the subscription's generated nodes, without the admin having to hardcode each remark name. That, plus dedicated UI fields fortype, health-checkurl/interval/timeout/lazy, and the MATCH target, would make this fully self-managing.This is not covered by the existing
subClashRules/subClashEnableRoutingmachinery — those fields are raw YAML with no templating support — so this is a valid new feature request. A related older request (#4404) was closed as completed after routing injection was added, but the dynamic-group / health-check part was never implemented.Affected files for a future implementation:
sub/subClashService.go—GetClash()buildsproxy-groups; needs to accept structured group config and populateproxiesfrom the generatedproxyNamessliceweb/service/setting.go— needs new settings keys (e.g.subClashGroupType,subClashGroupUrl,subClashGroupInterval, etc.)web/entity/entity.go—AllSettingstruct for the new fields@MHSanaei commented on GitHub (Jun 12, 2026):
Closing as a duplicate of #4941, which tracks the same request (customizable Clash/Mihomo proxy-groups with fallback/url-test for subscriptions). Let''s keep the discussion in #4941.