mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4848] [Question]: Global Xray settings (DNS, Routing, domainStrategy) are not reflected in generated client subscription configs #3378
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#3378
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 @rusik-afk on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4848
What are you trying to do?
I want my clients to automatically inherit the global Xray settings configured in the panel when they update their subscription.
Specifically, I have configured custom DNS servers (Cloudflare), routing strategies (IPIfNonMatch), and IPv4 preferences (UseIPv4) in the panel. However, when a client imports the subscription into their application (e.g., Happ / Hiddify), these settings are missing or overwritten by defaults (Google DNS, AsIs strategy).
I am trying to understand if client subscriptions are intentionally generated using an independent hardcoded template, or if there is a way to make them inherit the panel's global Xray configuration.
What have you already tried?
3x-ui version
3.2.6
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 26.04
Screenshots or config snippets
Here is the comparison between what is configured in the panel and what the client actually receives via the subscription link.
Global DNS & Routing:
@github-actions[bot] commented on GitHub (Jun 3, 2026):
Yes — this is by design, and here is exactly why
The JSON subscription endpoint (
/sub/json/<subId>) generates client configs from a hardcoded embedded template:sub/default.json. That template is compiled directly into the binary via//go:embed default.jsoninsub/subJsonService.goand is not derived from the server-side Xray configuration at all.The template hardcodes the following client defaults, regardless of what you have set in the panel's "Xray Configuration":
sub/default.jsondns.queryStrategy"UseIP"dns.servers[0].address"8.8.8.8"(Google DNS)routing.domainStrategy"AsIs"domainStrategy"AsIs"This separation is intentional: your server-side settings (e.g.
UseIPv4, Cloudflare DNS) control how the server routes outbound traffic, while the subscription template controls how the client app connects. Pushing server routing policy to every client app would often break clients on different networks.What the panel does let you customise per client config
The subscription server reads four configurable fields from panel settings (Panel → Subscription → JSON settings):
subJsonFragmentfragmentconfig to thedirect_outfreedom outboundsubJsonNoisesnoisesto the same freedom outboundsubJsonMuxmuxblock to every proxy outboundsubJsonRulesrulesto the default rule listCrucially, there are no panel settings for
dns.servers,dns.queryStrategy, orrouting.domainStrategyin client configs. Those are fixed insub/default.json.What you can do right now
Option 1 – Custom routing rules (partial help): The
subJsonRulespanel setting lets you add rules (e.g. bypass Iran/China IPs viadirect) to every generated client config. It will not change DNS servers or domainStrategy, but covers the routing-rules use case.Option 2 – Build from source with a patched
sub/default.json: If you self-host and can build the binary, you can editsub/default.jsonto change the default DNS servers and domain strategies before compiling. This is the only current path to a different hardcoded default.Option 3 – Request the feature: If you'd like the panel to expose DNS and domainStrategy as configurable subscription settings (similar to how
subJsonRulesworks), that would be a reasonable enhancement request. You could open a new issue with theenhancement/New Featurelabel describing exactly which fields you want to be configurable.Summary
Yes. The client JSON subscription is generated from a fixed embedded template (
sub/default.json), not from the server-side Xray config. The two configs are intentionally independent.The source file is
sub/default.json. There is no panel UI to modify it at runtime — it would need to be changed before building the binary (or the feature would need to be added to the panel).@MHSanaei commented on GitHub (Jun 12, 2026):
Closing as a duplicate of #4850, which tracks the same request (panel settings to customize DNS / queryStrategy / domainStrategy for generated client subscription configs). Let''s consolidate the discussion there.