mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5824] [Feature]: Add/Inject Routing Rules to JSON subscription #4045
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#4045
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 @ilya-practicum on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5824
Is your feature request related to a problem?
Sometimes it is useful to set different routing rules for different inbounds. Currently, you cannot ship several routing profiles in one subscription also you cannot apply different routing profiles for specific inbounds.
Describe the solution you'd like
For each inbound creation/edit window add new tab called "Routing" where you can add custom JSON routing block (similar to advanced tab for inbound editing).
Alternatives you've considered
No response
Concrete use case
When user connects to JSON subscription endpoint that routing blocks will be injected in corresponding outbounds sections. The idea is to provide geoip/geosite databses and JSON routing rules simultaneously:
That may be useful in situations when you have inbounds with different purposes - one for normal usage and other for Whitelist/AI/Torrent/etc.
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Frontend (UI / panel pages), Subscription (share links / Clash / JSON)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jul 5, 2026):
Confirmed in the source: this is not currently possible, and it is distinct from what exists today.
What exists now
subJsonRulespanel setting (Settings -> Subscription tab, "Direct routing" toggle infrontend/src/pages/settings/SubscriptionFormatsTab.tsx). Its JSON is merged into every generated config'srouting.rulesarray inNewSubJsonService(internal/sub/json_service.go:29-48), ahead of the rules frominternal/sub/default.json. It applies to the whole subscription output, not per inbound, and there is no per-inbound field on theInboundmodel (internal/database/model/model.go:46-86) to store a per-inbound routing block.frontend/src/pages/inbounds/form/InboundFormModal.tsx:1048,AdvancedAllEditor/AdvancedSliceEditor) edits the inbound's own Xray-side stream/sniffing JSON, not routing rules injected into subscription outbounds.vlessRoute(internal/sub/vless_route.go), which encodes a route number into unused VLESS UUID bytes so different hosts/endpoints can be distinguished server-side. It does not carry general JSON routing rules and only applies to VLESS.So today, shipping different routing profiles per inbound through the JSON subscription, as opposed to one global rule set for the whole subscription, would require the feature you are describing.
For context, a few related but distinct asks exist in this repo: #5124 (subscription "packages" with reusable route presets, open) and the closed #3879/#4776 (subscription-level routing/grouping ideas). None of them cover a per-inbound "Routing" tab with JSON injected specifically into that inbound's subscription outbounds, so this is not a duplicate.
Labeling as an enhancement for maintainer review.
This reply was generated automatically; a maintainer may follow up.
@ilya-practicum commented on GitHub (Jul 5, 2026):
In case this will be implemented, that will also be important to force user to use JSON subscription endpoint instead of deeplinks. To make this possible a checkbox in "Panel Settings -> Subscription" or "Client's Creation/Edit window" (to make settings apply to specific clients) will be useful. If it is checked then on Subscription page all deeplinks (in "Copy URL" section) will be removed and user is forced to use JSON with injected rules.
@JeuDeTarot commented on GitHub (Jul 24, 2026):
https://github.com/MHSanaei/3x-ui/issues/4479
+1
@isleuntothyself commented on GitHub (Aug 28, 2026):
+1