Skip to content

The http transport ​

The V2Ray/sing-box HTTP transport. With TLS it is HTTP/2: each protocol stream is the body of one HTTP/2 request (V2Ray h2); how streams share sessions is set by session_mode. Without TLS it is an HTTP/1.1 "camouflage": a request and a 200 answer, then the protocol stream in the same TCP connection. Compatible with sing-box http.

Fields ​

FieldTypeDefaultMeaning
hoststring or list—Host names; the client picks one, the server accepts only these
pathstring/The request path
methodstringPUTThe client's request method; a server with method set accepts only that one, without it any
headersmapping—Additional headers
idle_timeoutduration0 (off)After how much idleness to check the HTTP/2 session with a ping
ping_timeoutduration15sHow long to wait for the ping answer
session_modestringper_shardAs in grpc
session_per_shardboolfalseDeprecated: the same as session_mode: per_shard
share_sessionboolfalseDeprecated: the same as session_mode: shared

The server accepts both HTTP/1.1 and HTTP/2 (prior knowledge or ALPN h2), checks the path, and, with host set, the host name. A request that does not fit is refused with an error code.

Example ​

yaml
inbounds:
  vless-h2:
    vless:
      listen: ":443"
      users:
        - uuid: b831381d-6324-4d53-ad4f-8cda48b30811
      tls:
        certificate_path: /etc/ours/cert.pem
        key_path: /etc/ours/key.pem
      transport:
        http:
          host: [h2.example.com]
          path: /h2
outbounds:
  h2-out:
    vless:
      server: h2.example.com:443
      uuid: b831381d-6324-4d53-ad4f-8cda48b30811
      tls:
        sni: h2.example.com
      transport:
        http:
          host: h2.example.com
          path: /h2
          idle_timeout: 30s
route:
  final:
    outbound: h2-out

GPL-3.0-or-later