mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5889] [Feature]: Custom Clash/Mihomo subscription profiles with proxy-groups, rule-providers and rules #4082
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#4082
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 @heyzeyu on GitHub (Jul 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5889
Is your feature request related to a problem?
Yes.
3X-UI can generate Clash/Mihomo subscriptions and can inject routing rules, but it cannot define a complete client-side routing profile. In particular, administrators cannot manage custom
proxy-groups,rule-providers, and orderedrulesas part of a native subscription.My panel manages several exit scenarios:
3X-UI remains the source of truth for inbounds, clients, quotas, traffic statistics, and subscription links. However, the native subscription cannot express the strategy groups needed to select these exits or route company/private traffic differently. I currently have to maintain a separate static Clash YAML outside 3X-UI.
This creates two sources of truth. Node names or credentials can change in 3X-UI while the external Clash file remains stale, and each device needs extra configuration outside the panel.
Describe the solution you'd like
Add first-class Clash/Mihomo Subscription Profiles (or templates) to 3X-UI.
Each profile should support:
proxy-groupsrule-providersrulesSuggested variables:
A minimal profile could look like:
The generated proxies should still come from 3X-UI. The profile should only compose them into policy groups and routing rules.
Alternatives you've considered
A separate static Clash YAML
This works, but duplicates node configuration and becomes stale when 3X-UI changes.
Sub-Store or subconverter
These can transform subscriptions, but add another service and another management layer. Quotas, clients, and profiles are no longer managed in one panel.
Client-side override/merge files
This requires per-device configuration and is difficult to keep consistent across desktop and mobile clients.
Current Clash routing-rules field
It can inject
rules, but it cannot define the referenced customproxy-groupsorrule-providers. Rules alone are not enough for multiple selectable exits.Xray server-side routing
Server-side routing is useful but does not replace client-side policy selection. The user may need to choose between US ISP, US VPS, Hong Kong, DIRECT, or a company tunnel without creating a separate subscription for every combination.
Concrete use case
I use one 3X-UI installation for both company and personal devices.
When connected to the company network:
DIRECTWhen outside the company network:
Company-TunnelThe same generated nodes are reused, but I may bind two different routing profiles to two subscription URLs:
Work-Inside: company domains default toDIRECTWork-Outside: company domains default toCompany-TunnelA user should import one native 3X-UI subscription URL and receive a complete, ready-to-use Mihomo configuration without a second converter or local merge file.
Mockups, screenshots, or examples
Possible UI:
Generated subscription flow:
Related issues:
Which parts of the panel would this affect?
Frontend (UI / panel pages), Subscription (share links / Clash / JSON), Backend (API endpoints, login, settings)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jul 10, 2026):
Confirmed in the source: part of this already works today (undocumented), but the core "bind different profiles per client/group/inbound/subscription" ask does not exist yet.
What already works today
GetClash(internal/sub/clash_service.go:90-98) hardcodes exactly oneproxy-groupsentry — aselectgroup literally namedPROXYlisting every generated proxy plusDIRECT. However, the existing Panel Settings -> Subscription -> Clash / Mihomo -> Global routing rules field (settingsubClashRules, gated by thesubClashEnableRoutingtoggle) is not limited to bareGEOSITE/GEOIPlines.mergeClashRulesYAML(internal/sub/clash_service.go:780-810) parses the field as YAML, and when it is a map, every top-level key other thanrulesis copied verbatim into the generated config (base[key] = value). So pasting something like:already overrides the hardcoded
PROXYgroup and injectsrule-providersinto the output. This path was enabled by the fix for #5044 (closed), but it isn't mentioned anywhere: the field's own description is "Default Clash/Mihomo rules prepended to every generated YAML subscription before MATCH,PROXY" (internal/web/translation/en-US.json, keysubClashRoutingRulesDesc), the UI is a bareInput.TextAreawith a plain rule-line placeholder and no validation or preview (frontend/src/pages/settings/SubscriptionGeneralTab.tsx:170-177), the docs page doesn't cover it (docs/content/docs/en/config/subscription.mdx), andmergeClashRules/mergeClashRulesYAMLhave no test coverage anywhere in the repo. Treat it as an incidental capability, not a supported workflow.Confirmed gaps versus this request
subClashEnableRouting/subClashRulesare single global panel settings (defaults ininternal/web/service/setting.go:99-100, fields ininternal/web/entity/entity.go:90-91) — one value applies to every Clash subscription the panel serves. There is no per-client, per-group, per-inbound, or per-subscription-ID binding, so theWork-Inside/Work-Outsidetwo-profile scenario in this issue is not possible today.{{ALL_PROXIES}},{{PROXY_NAMES}}, etc.) exists. Proxy names come fromgenRemark/genTemplatedRemark(internal/sub/service.go:1853), and colliding names get an auto-appended-2/-3suffix (ensureUniqueProxyNames,internal/sub/clash_service.go:119-136, added for #4641), so a hand-writtenproxy-groups[].proxieslist has to track literal generated names by hand and can silently break if names shift.mergeClashRulesYAMLsilently falls back to treating it as a flat list of rule lines (internal/sub/clash_service.go:787-790) instead of surfacing an error.Related
#4941 already tracks the "only one hardcoded PROXY group" limitation (labeled enhancement/backlog); a prior reply there confirmed the same hardcoding and suggested a template field. This issue is broader — bindings, placeholders, validation/preview, a full profile concept — but shares the same root cause, so the maintainer may want to scope/track them together rather than as fully separate features. #5044 (rule-providers propagation, closed) and #5824 (per-inbound routing injection for JSON subscriptions, open, different output format) are related but narrower.
Labeling as an enhancement for @MHSanaei to weigh in on scope and priority.
This reply was generated automatically; a maintainer may follow up.
@xinghe361 commented on GitHub (Aug 11, 2026):
你好 我想请问一下啊 目前3xui能做到什么程度 能不能达到每个订阅id下发不同的节点但是一样的配置文件 类似于机场的那种 根据不同用户下发 我目前在里面填写之后无法下发节点 就是配置文件是正常的 没有节点信息 不知道是不是我哪里搞错了
@zhaoyangldahua-hub commented on GitHub (Aug 11, 2026):
什么叫一样的配置文件,可以多个入站给不同的用户分配不同的入站
Sent from Proton Mail for Android.
-------- Original Message --------
On Tuesday, 08/11/26 at 15:02 xinghe361 @.***> wrote:
@xinghe361 commented on GitHub (Aug 11, 2026):
就是rules dns tun这些下发都是一样的 节点不一样 就类似于机场 他们的下发除了节点都是一样的
@zhaoyangldahua-hub commented on GitHub (Aug 11, 2026):
可以啊,就平常设置就可以
Sent from Proton Mail for Android.
-------- Original Message --------
On Tuesday, 08/11/26 at 20:20 xinghe361 @.***> wrote:
@xinghe361 commented on GitHub (Aug 11, 2026):
不知道我哪里弄错了 直接填了之后下发的配置里没有节点 配置倒是成功下发了 能不能私聊指点一下
@zhaoyangldahua-hub commented on GitHub (Aug 11, 2026):
发个qq吧
Sent from Proton Mail for Android.
-------- Original Message --------
On Tuesday, 08/11/26 at 21:55 xinghe361 @.***> wrote:
@xinghe361 commented on GitHub (Aug 12, 2026):
你好 看到了吗
@xinghe361 commented on GitHub (Aug 13, 2026):
我先删掉了qaq
@Magic989 commented on GitHub (Oct 7, 2026):
I think it would be great if a relatively complete configuration file could be imported, with the node information in 3X-UI only covering the proxies section of it.