envoy-guide
Module 8 · Beyond HTTP·16 min·advanced

HTTP/3, QUIC, and UDP listeners

Serve HTTP/3 over QUIC and proxy raw UDP through Envoy.

QUIC in one paragraph

QUIC is TCP + TLS + multiplexing rebuilt from scratch over UDP. HTTP/3 is HTTP semantics over QUIC. Why bother?

  • 0-RTT resumption — no second-RTT TLS handshake on reconnect.
  • No head-of-line blocking — independent streams over one connection.
  • Connection migration — survives client IP changes (WiFi → LTE).
  • Faster on lossy networks — recovery is per-stream, not per-conn.

Envoy can act as a production HTTP/3 server. The catch: HTTP/3 runs over UDP, so it needs its own listener.

Clients discover HTTP/3 via the alt-svc response header returned on the HTTP/2 path. They cache it and switch to UDP on the next connection.

Minimal envoy.yaml — UDP listener with QUIC

YAML
listeners:
- name: h3
  address:
    socket_address: { protocol: UDP, address: 0.0.0.0, port_value: 443 }
  udp_listener_config:
    quic_options: {}
    downstream_socket_config: { prefer_gro: true }
  filter_chains:
  - transport_socket:
      name: envoy.transport_sockets.quic
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.transport_sockets.quic.v3.QuicDownstreamTransport
        downstream_tls_context:
          common_tls_context:
            alpn_protocols: ["h3"]
            tls_certificates:
            - certificate_chain: { filename: /etc/certs/tls.crt }
              private_key:       { filename: /etc/certs/tls.key }
    filters:
    - name: envoy.filters.network.http_connection_manager
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
        codec_type: HTTP3
        stat_prefix: h3
        http3_protocol_options: {}
        route_config:
          virtual_hosts:
          - name: app
            domains: ["*"]
            routes:
            - match: { prefix: "/" }
              route:
                cluster: app
                response_headers_to_add:
                - header: { key: alt-svc, value: 'h3=":443"; ma=86400' }
        http_filters:
        - name: envoy.filters.http.router
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

The alt-svc header on responses tells clients "next time, talk HTTP/3 to me on UDP/443."

Plain UDP proxying (no QUIC)

Envoy can also forward raw UDP — DNS, syslog, custom telemetry, game traffic — using envoy.filters.udp_listener.udp_proxy:

YAML
- name: dns_udp
  address:
    socket_address: { protocol: UDP, address: 0.0.0.0, port_value: 5353 }
  listener_filters:
  - name: envoy.filters.udp_listener.udp_proxy
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.UdpProxyConfig
      stat_prefix: dns
      matcher:
        on_no_match:
          action:
            name: route
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.Route
              cluster: dns_upstream
      idle_timeout: 30s

That's a complete UDP forwarder. Same xDS, same observability you get for HTTP.

Three pitfalls

Cert SAN must match the HTTP/2 hostname

Browsers do alt-svc only when the H3 endpoint presents the same cert. A mismatched SAN silently drops clients back to TCP and you'll think H3 is broken when it's a TLS issue.

MTU and middleboxes drop QUIC silently

Many corporate firewalls drop UDP/443 or fragment packets above ~1350 bytes. Set quic_protocol_options.initial_stream_window_size conservatively and verify with curl --http3 from outside the network. If your laptop is the only thing that works, that's a network problem, not a config problem.

Connection migration needs source-IP stability

QUIC's headline feature — surviving WiFi → LTE — only works if the load balancer in front of Envoy doesn't rebind ports. AWS NLB UDP and GCP TCP/UDP LBs are fine. NAT in front that rebinds breaks it. For multi-worker Envoy, prefer_gro: true and BPF-based packet steering are strongly recommended in production.

Hands-on: serve HTTP/3 from your laptop

Hands-on · curl --http3
  1. Generate a self-signed cert:
Shell
openssl req -x509 -newkey rsa:2048 -nodes \
  -keyout tls.key -out tls.crt \
  -subj /CN=localhost -days 1
  1. Save the QUIC listener config above (mount the certs into the container). Open BOTH TCP/443 and UDP/443 — most easily by adding a second TCP listener on 443 with the same routes plus the alt-svc header.

  2. Run Envoy:

Shell
docker run --rm -p 443:443 -p 443:443/udp -p 9901:9901 \
  -v "$PWD/envoy.yaml:/etc/envoy/envoy.yaml" \
  -v "$PWD/tls.crt:/etc/certs/tls.crt" \
  -v "$PWD/tls.key:/etc/certs/tls.key" \
  envoyproxy/envoy:v1.31-latest
  1. Test with HTTP/3:
Shell
curl --http3 -k https://localhost/

You'll see HTTP/3 200 in the verbose output.

  1. Bonus: also start the UDP DNS proxy and:
Shell
dig @127.0.0.1 -p 5353 example.com
curl -s localhost:9901/stats | grep dns.sess_total
Real-world example · A global edge optimising mobile latency
Problem
They want to cut p99 TLS handshake RTTs for mobile users on flaky 4G networks. The second-RTT TLS handshake on every cold connection adds 150-300ms of perceived latency on slow networks.
Envoy solution
Run Envoy with parallel TCP+UDP/443 listeners. The TCP path emits alt-svc: h3=:443 so Chrome on Android upgrades to H3 on the next request. After a week, p95 page-load on 4G drops 18% because QUIC's 0-RTT resumption skips the second-RTT TLS handshake.

When to reach for HTTP/3

  • Mobile-heavy traffic — connection migration + 0-RTT pay off.
  • High-loss networks — per-stream recovery beats TCP head-of-line.
  • CDN edges — every saved RTT compounds at scale.

For internal east-west traffic in a data center, HTTP/2 over TCP is still simpler and equally fast. HTTP/3 shines at the edge.

Quick check

How do clients discover that your origin supports HTTP/3?

Practical task
Finish the quick check and tick off the task to unlock.
Quick checkTasks 0/3