Skip to content

The xhttp transport ​

XHTTP (formerly SplitHTTP) from Xray: the protocol stream is split into ordinary HTTP requests; the download goes as one long response, the upload as one streaming request or as a series of POST packets. Passes through CDNs that support neither WebSocket nor gRPC. Compatible with Xray XHTTP over HTTP/1.1, HTTP/2 and HTTP/3; sing-box has no such transport. vless and trojan have XHTTP; HTTP/3 and download are vless only.

Fields ​

FieldTypeDefaultMeaning
modestringautoThe mode, see below
pathstring/The base path; the session ID and the packet number are appended to it. ?query is allowed
hoststringtls.sni, otherwise the server addressThe host name; a server with host set accepts only that one
headersmapping—Additional headers; Host, Content-Length, Content-Type, Transfer-Encoding, Connection are not allowed
http_versionauto, 1.1, 2, 3autoauto is as in Xray: without TLS, HTTP/1.1; with TLS by tls.alpn: exactly h3 gives HTTP/3, exactly http/1.1 gives HTTP/1.1, otherwise (and under REALITY) HTTP/2. 3 is HTTP/3 over QUIC and needs TLS without REALITY
paddingnumber100Padding length in bytes; the server requires no less, up to 8192
padding_obfsblocknonePadding not in Referer but where the block says (Xray xPaddingObfsMode), see below
uplinkblocksee belowHow the client sends data
session, seqblocksin the pathWhere the session ID and the packet number go, see below
no_grpc_headerboolfalseThe client does not set Content-Type: application/grpc on stream-up/stream-one requests
no_sse_headerboolfalseThe server does not set Content-Type: text/event-stream on streaming responses
h2block—The server's HTTP/2 (Xray h2Params): max_concurrent_streams (128), stream_window (2 MiB), connection_window (16 MiB), max_frame_size
downloadblocknoneDownload from another server (Xray downloadSettings), see below
postsblocksee belowThe POSTs of the packet-up mode: max_bytes — the largest size of one (1000000), max_buffered — how many the server buffers per session (30), min_interval — the smallest interval between the client's POSTs (30ms)
xmuxblocksee belowHow the client shares HTTP connections between sessions

Limits: posts.max_bytes ≤ 16 MiB, posts.max_buffered ≤ 1024, their product ≤ 64 MiB, padding ≤ 8192; going over any of them gives XHTTP buffering/header limits exceeded. Xray names with prefixes (sc_*, x_padding_bytes, c_*, h_*) are an error with a hint.

Modes ​

modeDownloadUpload
packet-upGET with a long responsea series of POST /<path>/<session>/<number>
stream-upGET with a long responseone streaming POST /<path>/<session>
stream-oneone POST /<path> request in both directions
autoclient: stream-one under REALITY, otherwise packet-up; server: accepts all modes

In auto the client picks the mode as Xray does; with download under REALITY, stream-up. A server with a specific mode accepts only that one. The upload method is set by uplink.method; the server, like Xray, treats as an upload any request other than GET and a GET with a packet number, and an OPTIONS with Access-Control-Request-Method as a CORS preflight (it answers 200).

Padding, session ID, packet number, data ​

The fields are Xray names without prefixes; the values are as in Xray.

Block.fieldXrayMeaning
padding_obfs.placementxPaddingPlacementqueryInHeader (default: a URL with ?<key>=… in the header header), header, cookie, query
padding_obfs.keyxPaddingKeyThe name of the parameter or cookie (x_padding)
padding_obfs.headerxPaddingHeaderThe header (X-Padding)
padding_obfs.methodxPaddingMethodrepeat-x (X…) or tokenish (base62, the length by the HPACK Huffman code)
uplink.methoduplinkHTTPMethodThe upload method (POST); GET only in packet-up
uplink.data_placementuplinkDataPlacementWhere the packet data goes: auto/body (the body), header, cookie — base64url in chunks; the last two only in packet-up
uplink.data_keyuplinkDataKeyThe name of the headers <key>-<i> (X-Data) or cookies <key>_<i> (x_data)
uplink.chunk_sizeuplinkChunkSizeThe size of a base64 chunk in a header or cookie (from 64; by default 3000–4000 and 2048–3072)
session.placement, seq.placementsessionIDPlacement, seqPlacementpath (default), query, header, cookie
session.key, seq.keysessionIDKey, seqKeyThe name of the parameter, header or cookie (x_session/X-Session, x_seq/X-Seq)
session.table, session.lengthsessionIDTable, sessionIDLengthThe ID alphabet (or an Xray name: hex, Base62, …) and length; without them the ID is a UUID

With data in headers the server must accept such headers: posts.max_bytes should be reduced (Xray's default header limit is 8 KiB). The server answers with CORS headers and padding (X-Padding or per padding_obfs), as Xray does.

download ​

The session's download goes to another server — the same XHTTP server, but at another address (through a CDN, directly): server: host:port, its own tls (the same block as the outbound's; without it, no TLS) and XHTTP fields for this request (path, host, headers, http_version, padding, xmux, …). The upload goes to the outbound's server. Cannot be combined with stream-one.

HTTP/3 ​

The client opens QUIC connections through the outbound's dialer with its TLS (without uTLS); a server (vless) with XHTTP over HTTP/3 listens on UDP instead of TCP, and TLS is mandatory for it.

xmux ​

FieldMeaning
max_connectionsThe largest number of HTTP connections; incompatible with max_concurrency (≤ 1024)
max_concurrencyHow many sessions per connection (≤ 65535)
max_reuse_timesHow many times a connection may be reused (0 means no limit)
max_request_timesHow many requests per connection
max_reusableHow long a connection is fit for new sessions, a duration (e.g. 30m)
keep_alive_periodThe HTTP/2 keep-alive period, a duration (e.g. 30s)

If xmux is not set at all: max_connections: 3, max_request_times: 600, max_reusable: 30m. If at least one field is set, the others are 0 (no limit).

Example ​

yaml
inbounds:
  vless-xhttp:
    vless:
      listen: ":443"
      users:
        - uuid: b831381d-6324-4d53-ad4f-8cda48b30811
      tls:
        certificate_path: /etc/ours/cert.pem
        key_path: /etc/ours/key.pem
      transport:
        xhttp:
          path: /xh
          mode: auto
outbounds:
  xhttp-out:
    vless:
      server: cdn.example.com:443
      uuid: b831381d-6324-4d53-ad4f-8cda48b30811
      tls:
        sni: cdn.example.com
      transport:
        xhttp:
          path: /xh
          mode: stream-up
          xmux:
            max_concurrency: 16
            max_reusable: 600s
          download:
            server: 203.0.113.7:443
            tls:
              sni: cdn.example.com
            path: /xh
route:
  final:
    outbound: xhttp-out

With VLESS Encryption XHTTP also works together with flow: xtls-rprx-vision.

GPL-3.0-or-later