mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5572] [Bug]: Routing #3889
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#3889
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 @FPu3EpOBIIIuK on GitHub (Jun 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5572
Describe the bug
When specifying an IP address or domain, routing does not work.
How to reproduce the problem
Domain: myip.com
Inbound tag: in-8888-tcp
Outbound tag: Routing
Expected behavior
It was assumed that when connected to in-8888-tcp and opening the website myip.com, the traffic would be routed through the outbound "Routing".
Actual behavior
When connected to in-8888-tcp and opening the website myip.com, the traffic goes directly to "direct".
However, if a user is specified instead of a domain, the traffic of that user connected through this inbound is successfully routed through the outbound "Routing".
I have also tried specifying, for example, geosite:YOUTUBE, but the issue persists.
Relevant logs
Screenshots
No response
3x-ui version
3.4.0
Xray-core version
26.6.22
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 25, 2026):
The symptom — domain rules have no effect but user rules work — is the expected result when sniffing is disabled on the inbound. This is Xray-core behavior, not a 3x-ui bug.
Why user rules work but domain rules do not
When Xray receives a connection on
in-8888-tcp, it knows the authenticated client identity (used by theusermatcher) from the protocol handshake. It does not, however, know the requested domain unless sniffing is enabled. Without sniffing, thedomainandgeosite:*matchers in routing rules have nothing to match against, so the rule is skipped and traffic falls through todirect. The same applies togeosite:YOUTUBE.Fix: enable sniffing on the inbound
in-8888-tcpfor editing.destOverrideset tohttp,tls,quic(the defaults fromfrontend/src/schemas/primitives/sniffing.ts).routeOnly: true) if you do not want Xray to rewrite the destination address — this is the right setting when the inbound is a proxy (VLESS/VMess/Trojan) that already carries the target domain in its own header.After saving, the generated Xray config for that inbound will include a block such as:
With sniffing active, Xray extracts the SNI or HTTP
Hostfor TLS/HTTP connections and populates the routing context with the domain, allowing"domain": ["myip.com"]and"geosite:YOUTUBE"rules to match.Additional note on
domainStrategyThe default Xray template shipped by 3x-ui (confirmed in
internal/web/service/config.json) setsrouting.domainStrategyto"AsIs". UnderAsIs, Xray matches routing rules against the domain name extracted by sniffing; it does not perform DNS resolution to derive a domain from a raw IP. If the client connects by IP rather than hostname and sniffing cannot extract a domain, domain-based rules will still not match. If that scenario matters, you can changedomainStrategyto"IPIfNonMatch"or"IPOnDemand"in Xray → Core Config.This reply was generated automatically; a maintainer may follow up.
@FPu3EpOBIIIuK commented on GitHub (Jun 25, 2026):
I configured it according to your instructions, everything worked as expected. Thank you for the detailed and prompt response.