mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5570] [Feature]: Clash and XRay subscriptions on one URL #3891
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#3891
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 @indx0 on GitHub (Jun 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5570
Is your feature request related to a problem?
Right now clash and XRay subs are on different URLs, which is uncomfortable for users and for administrators, moving from other panels with this functionality.
Describe the solution you'd like
The client can be determined with user agent, which is passed when getting a subscription. The regex expressions used for client detection can be found in remnawave or pasarguard source code.
Alternatives you've considered
This can be done via a reverse proxy, but since 3x-ui is a user-friendly panel, it would be better to add this in panel directly, like everywhere else.
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 25, 2026):
The panel currently exposes three fully separate URL prefixes for subscription formats, with no user-agent routing between them. This is confirmed in
internal/sub/controller.go(initRouter, lines 132–146): thesubshandler serves raw base64 share links,subJsonsserves the JSON config, andsubClashsserves Clash YAML — each registered under its own path group (/sub/,/json/,/clash/by default, all configurable in Settings).What implementing this would require
The cleanest approach would be to add an optional handler on the existing
/sub/<subid>path that inspects theUser-Agentheader before delegating:User-Agentmatches a known Clash/Mihomo pattern → callSubClashService.GetClashand return YAML.SubJsonService.GetJsonand return JSON.The existing per-format paths would remain active alongside, so existing client configurations would not break.
Implementation notes for a contributor
internal/sub/controller.go, most naturally at the top ofsubs(), before the current branch onwantsHTML.SubClashServiceandSubJsonServiceare already members ofSUBController, so no new wiring is needed to call them fromsubs().subAutoDetect bool) could gate the feature so admins can opt out if they want strict path separation.Content-Type: application/yamland the JSON responseapplication/json, matching whatsubClashsandsubJsonsalready do.User-Agentstrings.This is a reasonable quality-of-life feature. Whether and when it is added is up to the maintainers.
This reply was generated automatically; a maintainer may follow up.