[GH-ISSUE #5065] [Feature]: Fallback for vless+xhttp #3565

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

Originally created by @Jabca on GitHub (Jun 7, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5065

No way to define fallback for vless+xhttp inbound, like redirect or defined payload

Describe the solution you'd like

Page in ui to add fallbacks for the inbound

Alternatives you've considered

  1. manually rewrite config via 'advanced' tab (get's overwritten after save)
  2. manually rewrite x-ray config (also gets overwritten)

Concrete use case

I want my domain to look legit, by adding some mockup of a web page for port 443

Mockups, screenshots, or examples

Image

Which parts of the panel would this affect?

Frontend (UI / panel pages)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @Jabca on GitHub (Jun 7, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5065 ### Is your feature request related to a problem? No way to define fallback for vless+xhttp inbound, like redirect or defined payload ### Describe the solution you'd like Page in ui to add fallbacks for the inbound ### Alternatives you've considered 1. manually rewrite config via 'advanced' tab (get's overwritten after save) 2. manually rewrite x-ray config (also gets overwritten) ### Concrete use case I want my domain to look legit, by adding some mockup of a web page for port 443 ### Mockups, screenshots, or examples <img width="1524" height="1270" alt="Image" src="https://github.com/user-attachments/assets/2d7f3b56-e8ba-4bbc-a7ad-b6801c2f9abf" /> ### Which parts of the panel would this affect? Frontend (UI / panel pages) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:33:22 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 7, 2026):

Thanks for the detailed request, @Jabca.

Current state

3x-ui already has a full Fallbacks UI (the FallbacksCard component with add/remove/reorder rows, SNI/ALPN/Path/Dest/Xver fields) and a complete backend service (web/service/fallback.go). However, the fallback feature is gated to TCP transport only, enforced in two places:

  • Frontend (frontend/src/pages/inbounds/form/InboundFormModal.tsx:179–182):
    const isFallbackHost =
      (protocol === Protocols.VLESS || protocol === Protocols.TROJAN)
      && network === 'tcp'
      && (security === 'tls' || security === 'reality');
    
  • Backend (web/service/inbound.go:443–451): inboundCanHostFallbacks() applies the same TCP + TLS/Reality check before injecting settings.fallbacks into the Xray config.

Why XHTTP is excluded

Xray-core's fallbacks array (in VLESS/Trojan inbound settings) is a raw-TCP intercept: after a TLS handshake, Xray peeks at the first bytes; if they don't match the proxy protocol, it forwards the raw byte stream to another port/process. This works because Xray still has the bare TCP connection at that point.

With XHTTP transport, the stream is already parsed as HTTP by the time Xray hands it to the proxy layer. There is no bare TCP stream left to forward, so the fallbacks mechanism simply does not apply. The XHTTP settings schema (frontend/src/schemas/protocols/stream/xhttp.ts) has no fallback or redirect field, and Xray-core does not expose one for this transport.

What this feature would require

For the UI goal to be achievable end-to-end, Xray-core would first need to expose a per-path "unmatched-request" redirect/response mechanism for XHTTP inbounds. Once that exists upstream, 3x-ui could surface it in the XHTTP transport form (not through the existing FallbacksCard, which is TCP-specific).

Workaround in the meantime

The cleanest way to make port 443 serve a real webpage for non-proxy visitors while VLESS+XHTTP runs behind it is to put a reverse proxy (e.g. Nginx or Caddy) in front:

  1. Nginx/Caddy listens on 443, handles TLS, serves your static site by default.
  2. For the specific XHTTP path (e.g. /your-path), proxy_pass to Xray's XHTTP inbound (listening on a local port without TLS).

This keeps the "legit domain" appearance and is not overwritten by panel saves. The panel's Advanced tab and raw-config editing remain workarounds but will indeed be overwritten — the panel is the authoritative config source, which is by design.

If Xray-core adds native XHTTP fallback/redirect support in a future release, please reopen or link that upstream issue here so 3x-ui can track it.

<!-- gh-comment-id:4644247063 --> @github-actions[bot] commented on GitHub (Jun 7, 2026): Thanks for the detailed request, @Jabca. ## Current state 3x-ui already has a full **Fallbacks UI** (the `FallbacksCard` component with add/remove/reorder rows, SNI/ALPN/Path/Dest/Xver fields) and a complete backend service (`web/service/fallback.go`). However, the fallback feature is gated to **TCP transport only**, enforced in two places: - **Frontend** (`frontend/src/pages/inbounds/form/InboundFormModal.tsx:179–182`): ```ts const isFallbackHost = (protocol === Protocols.VLESS || protocol === Protocols.TROJAN) && network === 'tcp' && (security === 'tls' || security === 'reality'); ``` - **Backend** (`web/service/inbound.go:443–451`): `inboundCanHostFallbacks()` applies the same TCP + TLS/Reality check before injecting `settings.fallbacks` into the Xray config. ## Why XHTTP is excluded Xray-core's `fallbacks` array (in VLESS/Trojan inbound settings) is a **raw-TCP intercept**: after a TLS handshake, Xray peeks at the first bytes; if they don't match the proxy protocol, it forwards the raw byte stream to another port/process. This works because Xray still has the bare TCP connection at that point. With XHTTP transport, the stream is **already parsed as HTTP** by the time Xray hands it to the proxy layer. There is no bare TCP stream left to forward, so the `fallbacks` mechanism simply does not apply. The XHTTP settings schema (`frontend/src/schemas/protocols/stream/xhttp.ts`) has no `fallback` or `redirect` field, and Xray-core does not expose one for this transport. ## What this feature would require For the UI goal to be achievable end-to-end, Xray-core would first need to expose a per-path "unmatched-request" redirect/response mechanism for XHTTP inbounds. Once that exists upstream, 3x-ui could surface it in the XHTTP transport form (not through the existing `FallbacksCard`, which is TCP-specific). ## Workaround in the meantime The cleanest way to make port 443 serve a real webpage for non-proxy visitors while VLESS+XHTTP runs behind it is to put a reverse proxy (e.g. **Nginx** or **Caddy**) in front: 1. Nginx/Caddy listens on 443, handles TLS, serves your static site by default. 2. For the specific XHTTP path (e.g. `/your-path`), `proxy_pass` to Xray's XHTTP inbound (listening on a local port without TLS). This keeps the "legit domain" appearance and is not overwritten by panel saves. The panel's **Advanced** tab and raw-config editing remain workarounds but will indeed be overwritten — the panel is the authoritative config source, which is by design. If Xray-core adds native XHTTP fallback/redirect support in a future release, please reopen or link that upstream issue here so 3x-ui can track it.
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#3565
No description provided.