[GH-ISSUE #5478] [Bug]: XTLS/TLS not applying correctly to XHTTP in multi-inbound setup (Reality + XHTTP) #3831

Closed
opened 2026-10-31 20:35:16 +07:00 by bsakaguchi · 1 comment
Owner

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

  1. Configure a multi-inbound setup with Reality and XHTTP.
  2. Enable XTLS.
  3. Verify Reality inbound works correctly.
  4. Observe that XHTTP inbound does not function properly.
  5. Disable TLS for XHTTP and observe that it starts working again.

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

don't need this but:
# journalctl -u x-ui -n 200
Jun 21 22:55:52 $$ x-ui[$$]: 2026/06/21 22:55:52.960035 [Warning] infra/conf: ====== SECURITY WARNING ======
Jun 21 22:55:52 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor".
Jun 21 22:55:52 $$ x-ui[$$]: THIS IS VERY INSECURE!!!
Jun 21 22:55:52 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly.
Jun 21 22:55:52 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately.
Jun 21 22:55:52 $$ x-ui[$$]: In future versions, this option must be explicitly set.
Jun 21 22:55:52 $$ x-ui[$$]: ====== SECURITY WARNING ======
Jun 21 22:56:54 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection
Jun 21 22:56:54 $$ x-ui[$$]: 2026/06/21 22:56:54.412209 [Warning] infra/conf: ====== SECURITY WARNING ======
Jun 21 22:56:54 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor".
Jun 21 22:56:54 $$ x-ui[$$]: THIS IS VERY INSECURE!!!
Jun 21 22:56:54 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly.
Jun 21 22:56:54 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately.
Jun 21 22:56:54 $$ x-ui[$$]: In future versions, this option must be explicitly set.
Jun 21 22:56:54 $$ x-ui[$$]: ====== SECURITY WARNING ======
Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection
Jun 21 22:58:46 $$ x-ui[$$]: 2026/06/21 22:58:46.528079 [Warning] infra/conf: ====== SECURITY WARNING ======
Jun 21 22:58:46 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor".
Jun 21 22:58:46 $$ x-ui[$$]: THIS IS VERY INSECURE!!!
Jun 21 22:58:46 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly.
Jun 21 22:58:46 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately.
Jun 21 22:58:46 $$ x-ui[$$]: In future versions, this option must be explicitly set.
Jun 21 22:58:46 $$ x-ui[$$]: ====== SECURITY WARNING ======
Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: WARNING - XRAY: transport/internet/tls: ignoring invalid OCSP > common/ocsp: no OCSP server specified in cert
Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: WARNING - XRAY: transport/internet/tls: ignoring invalid OCSP > common/ocsp: no OCSP server specified in cert
Jun 21 22:59:13 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP f

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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 1. Configure a multi-inbound setup with Reality and XHTTP. 2. Enable XTLS. 3. Verify Reality inbound works correctly. 4. Observe that XHTTP inbound does not function properly. 5. Disable TLS for XHTTP and observe that it starts working again. ### 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 ```shell don't need this but: # journalctl -u x-ui -n 200 Jun 21 22:55:52 $$ x-ui[$$]: 2026/06/21 22:55:52.960035 [Warning] infra/conf: ====== SECURITY WARNING ====== Jun 21 22:55:52 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor". Jun 21 22:55:52 $$ x-ui[$$]: THIS IS VERY INSECURE!!! Jun 21 22:55:52 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly. Jun 21 22:55:52 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately. Jun 21 22:55:52 $$ x-ui[$$]: In future versions, this option must be explicitly set. Jun 21 22:55:52 $$ x-ui[$$]: ====== SECURITY WARNING ====== Jun 21 22:56:54 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection Jun 21 22:56:54 $$ x-ui[$$]: 2026/06/21 22:56:54.412209 [Warning] infra/conf: ====== SECURITY WARNING ====== Jun 21 22:56:54 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor". Jun 21 22:56:54 $$ x-ui[$$]: THIS IS VERY INSECURE!!! Jun 21 22:56:54 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly. Jun 21 22:56:54 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately. Jun 21 22:56:54 $$ x-ui[$$]: In future versions, this option must be explicitly set. Jun 21 22:56:54 $$ x-ui[$$]: ====== SECURITY WARNING ====== Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP for XHTTP > accept tcp [::]:443: use of closed network connection Jun 21 22:58:46 $$ x-ui[$$]: 2026/06/21 22:58:46.528079 [Warning] infra/conf: ====== SECURITY WARNING ====== Jun 21 22:58:46 $$ x-ui[$$]: inbound "in-443-tcp" using splithttp has not configured "sockopt.trustedXForwardedFor". Jun 21 22:58:46 $$ x-ui[$$]: THIS IS VERY INSECURE!!! Jun 21 22:58:46 $$ x-ui[$$]: For compatibility, Xray still allows this for now and still trusts X-Forwarded-For implicitly. Jun 21 22:58:46 $$ x-ui[$$]: Please configure "sockopt.trustedXForwardedFor" immediately. Jun 21 22:58:46 $$ x-ui[$$]: In future versions, this option must be explicitly set. Jun 21 22:58:46 $$ x-ui[$$]: ====== SECURITY WARNING ====== Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: WARNING - XRAY: transport/internet/tls: ignoring invalid OCSP > common/ocsp: no OCSP server specified in cert Jun 21 22:58:46 $$ /usr/local/x-ui/x-ui[$$]: WARNING - XRAY: transport/internet/tls: ignoring invalid OCSP > common/ocsp: no OCSP server specified in cert Jun 21 22:59:13 $$ /usr/local/x-ui/x-ui[$$]: ERROR - XRAY: transport/internet/splithttp: failed to serve HTTP f ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:16 +07:00
Author
Owner

@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-vision flow 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 from client_inbounds.flow_override. The save-time gate (clientWithInboundFlow in internal/web/service/client_crud.go:148) correctly clears the flow for XHTTP without vlessenc — but the seedClientsFromInboundJSON migration (internal/database/db.go:824) that populated client_inbounds when the multi-inbound schema was introduced copies FlowOverride: c.Flow without 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 carries flow_override = xtls-rprx-vision in 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.json on 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_override to "" 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:

  1. The XHTTP inbound's entry from the exported Xray config (/usr/local/x-ui/config.json) — specifically the streamSettings block and the clients array, with UUIDs and keys redacted.
  2. The port and transport (TCP/XHTTP) of the Reality inbound — confirm whether it is the same port (443) as the XHTTP inbound.
  3. Whether the XHTTP inbound's streamSettings contains "security": "tls" or "security": "xtls", and if so, whether tlsSettings.certificateFile points to a valid certificate.
  4. When the setup was originally created (before or after v3.2.8 released on 2026-06-05).

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4763648422 --> @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-vision` flow 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 from `client_inbounds.flow_override`. The save-time gate (`clientWithInboundFlow` in `internal/web/service/client_crud.go:148`) correctly clears the flow for XHTTP without vlessenc — but the `seedClientsFromInboundJSON` migration (`internal/database/db.go:824`) that populated `client_inbounds` when the multi-inbound schema was introduced copies `FlowOverride: c.Flow` without 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 carries `flow_override = xtls-rprx-vision` in 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.json` on 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_override` to `""` 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: 1. The XHTTP inbound's entry from the exported Xray config (`/usr/local/x-ui/config.json`) — specifically the `streamSettings` block and the `clients` array, with UUIDs and keys redacted. 2. The port and transport (TCP/XHTTP) of the Reality inbound — confirm whether it is the same port (443) as the XHTTP inbound. 3. Whether the XHTTP inbound's `streamSettings` contains `"security": "tls"` or `"security": "xtls"`, and if so, whether `tlsSettings.certificateFile` points to a valid certificate. 4. When the setup was originally created (before or after v3.2.8 released on 2026-06-05). *This reply was generated automatically; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3831
No description provided.