HTTP/2

The transmission mode based on HTTP/2 fully implements the HTTP/2 standard and can be relayed by other HTTP servers (such as Nginx).

Based on the recommendations of HTTP/2, both the client and server must enable TLS to use this transmission mode normally.

HTTP/2 has built-in multiplexing, so it is not recommended to enable mux.cool when using HTTP/2.

Tip

The current version of the transmission mode based on HTTP/2 does not require TLS configuration for inbound (server-side).

This makes it possible to use a plaintext HTTP/2 protocol called h2c for communication between the gateway and Xray, with external gateway components handling the TLS layer conversation in special-purpose load-balancing deployment environments.

Warning

⚠️ If you are using fallback, please note the following:

  • Please make sure that h2 is included in (x)tlsSettings.alpn, otherwise HTTP/2 cannot complete TLS handshake.
  • HTTP/2 cannot perform path-based routing, so it is recommended to use SNI-based routing.

HttpObject

HttpObject corresponds to the httpSettings in the Transport Protocol,

{
  "host": ["xray.com"],
  "path": "/random/path",
  "read_idle_timeout": 10,
  "health_check_timeout": 15,
  "method": "PUT",
  "headers": {
    "Header": ["value"]
  }
}

host: [string]

A string array, where each element is a domain name.

The client will randomly select a domain name from the list for communication, and the server will verify whether the domain name is in the list.

path: string

The HTTP path starts with / and must be the same value between the client and server.

The default value is /

read_idle_timeout: number

The connection health check is performed when no data has been received for a certain period of time, measured in seconds.

By default, the health check is disabled.

Tip

Only need to be configured in outbound (client).

Tip

Enabling health checks may help solve some "connection drop" issues.

health_check_timeout: number

The timeout for the health check, measured in seconds. If the health check is not completed within this time period, it is considered to have failed. The default value is 15

Tip

Only need to be configured in outbound (client).

method: string

HTTP request method. The default value is PUT

Please refer this thisopen in new tag when configure.

headers: map{ string: [string] }

Custom HTTP headers, defined as key-value pairs. Each key represents an HTTP header name and its corresponding value is an array.