mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5478] [Bug]: XTLS/TLS not applying correctly to XHTTP in multi-inbound setup (Reality + XHTTP) #3831
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#3831
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 @mazyarzohdi on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5478
Describe the bug
I am using a multi-inbound setup with both Reality and XHTTP configurations.
When I enable XTLS, it works correctly for Reality-based inbounds, and those connections function as expected. However, XTLS does not seem to be applied or take effect for XHTTP inbounds, and as a result, XHTTP does not work properly.
I also tested this behavior on a different server. In that case, when TLS is enabled for XHTTP, the same issue occurs. When TLS is disabled for XHTTP, the XHTTP configuration works correctly again.
It appears that TLS/XTLS handling is inconsistent between Reality and XHTTP in a multi-inbound environment, or that XHTTP is not correctly processing TLS settings when XTLS is enabled globally or per inbound.
How to reproduce the problem
Expected behavior
No response
Actual behavior
Reality works correctly with XTLS enabled.
XHTTP does not work when XTLS/TLS is enabled.
Disabling TLS for XHTTP makes it functional again.
Relevant logs
Screenshots
No response
3x-ui version
3.3.1
Xray-core version
26.6.1
How did you install 3x-ui?
install.sh script
Operating system
ubuntu 24.04
Which parts of the panel are affected?
Xray config generation
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
@github-actions[bot] commented on GitHub (Jun 21, 2026):
Three distinct mechanisms can produce this pattern on a Reality + XHTTP setup; one of them is a known panel bug that can survive an upgrade. Diagnosed below against the v3.3.1 source.
Mechanism 1 — stale
xtls-rprx-visionflow in the XHTTP inbound config (most likely if setup predates v3.2.8)GetXrayConfig(internal/web/service/xray.go) emits"flow": "xtls-rprx-vision"into client entries verbatim fromclient_inbounds.flow_override. The save-time gate (clientWithInboundFlowininternal/web/service/client_crud.go:148) correctly clears the flow for XHTTP without vlessenc — but theseedClientsFromInboundJSONmigration (internal/database/db.go:824) that populatedclient_inboundswhen the multi-inbound schema was introduced copiesFlowOverride: c.Flowwithout applying that gate. If your inbounds were created before the v3.2.8 fix (which added flow isolation) and the seeder ran at that time, every XHTTP client that shared a UUID with a Reality client still carriesflow_override = xtls-rprx-visionin the database. Xray-core does not support Vision flow on XHTTP/splithttp transport (confirmed in xray-core upstream), so every connection is rejected.To verify: export the running Xray config from the panel (Settings → Xray Configuration, or
cat /usr/local/x-ui/config.jsonon the server) and look for the XHTTP inbound block. If any client entry under it has"flow": "xtls-rprx-vision", this is the cause.To fix: go to the Clients page, open each shared client, and save without changes. This triggers the save-time gate which rewrites
flow_overrideto""for XHTTP inbounds. After saving, restart Xray from the panel to apply the updated config.Mechanism 2 — double-TLS when XHTTP is used as a fallback target from Reality
If Reality is configured on port 443 with a fallback that hands non-Reality traffic to the XHTTP inbound (even on a loopback port), the traffic arriving at XHTTP has already been decrypted by Reality's XTLS stack. Enabling TLS on the XHTTP inbound in this topology means XHTTP expects an encrypted TLS stream but receives plaintext HTTP, causing the handshake to fail. Disabling TLS on XHTTP restores correct operation because it processes the already-decrypted traffic from the fallback. This is not a panel bug — it is a configuration error: XHTTP acting as a fallback target must not have TLS enabled.
Mechanism 3 — two inbounds directly sharing port 443
The panel's port conflict checker (
internal/web/service/port_conflict.go) prevents two TCP inbounds from binding to the same port. If both Reality and XHTTP somehow ended up on port 443 as separate bindings (e.g., one was created before the conflict check was robust, or the config template has a hand-edited inbound), only one can listen. The"failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection"entries in your logs are normal Xray restart artifacts (the listener is closed during each restart and Accept() fails once) and do not indicate the root cause on their own.To narrow down which mechanism applies, please provide:
/usr/local/x-ui/config.json) — specifically thestreamSettingsblock and theclientsarray, with UUIDs and keys redacted.streamSettingscontains"security": "tls"or"security": "xtls", and if so, whethertlsSettings.certificateFilepoints to a valid certificate.This reply was generated automatically; a maintainer may follow up.