HTTP/2

Enable HTTP/2 on a listener for multiplexed connections, header compression, and gRPC support.

Configuration

{
  "name": "h2-listener",
  "port": 9090,
  "http2": true
}

Set http2: true on the listener. That’s it.

Examples

gRPC listener (TLS + HTTP/2)

gRPC requires HTTP/2. With TLS, Go negotiates HTTP/2 via ALPN automatically:

{
  "name": "grpc",
  "port": 443,
  "http2": true,
  "tls": {
    "cert": "/certs/tls.crt",
    "key": "/certs/tls.key"
  }
}

Clients that negotiate h2 over ALPN get HTTP/2. Clients that negotiate http/1.1 get HTTP/1.1. Both work on the same port.

h2c (HTTP/2 cleartext, no TLS)

{
  "name": "h2c",
  "port": 8080,
  "http2": true
}

Without TLS, Vrata supports h2c — HTTP/2 over plaintext using the Upgrade mechanism. This is common behind a load balancer that already terminates TLS.

Mixed listener (HTTP/1.1 + HTTP/2 + TLS)

{
  "name": "mixed",
  "port": 443,
  "http2": true,
  "tls": {
    "cert": "/certs/tls.crt",
    "key": "/certs/tls.key"
  }
}

Both HTTP/1.1 and HTTP/2 clients connect on the same port. ALPN negotiation picks the best protocol for each connection.

HTTP/1.1 only (default)

{
  "name": "h1-only",
  "port": 8080
}

Omit http2 (or set it to false). Only HTTP/1.1 is accepted.

When to enable HTTP/2

When to keep HTTP/1.1

HTTP/2 to upstream

The listener’s http2 setting controls the client ↔ proxy protocol. To use HTTP/2 between the proxy and the upstream, set options.http2: true on the destination:

{
  "name": "grpc-backend",
  "host": "grpc-svc.default.svc.cluster.local",
  "port": 50051,
  "options": {
    "http2": true
  }
}