Pcornel
Browse topics
Options
Recent
Favorites
Web Infrastructure · Technical reference

HTTP/2

Direct answer

HTTP/2 keeps HTTP semantics but sends them as binary frames on numbered streams, multiplexing many requests over a single TCP connection with compressed headers (HPACK).

When to use this

Use it on every public HTTPS site; browsers negotiate it with ALPN h2. It removes most of the need for multiple connections and domain sharding.

First 30 seconds

1. Does ALPN select h2?

2. Does every hop support it, or does a proxy downgrade to HTTP/1.1 (normal toward backends)?

3. Are many requests still slow — check TCP loss, not HTTP?

Operational verification

TCP → TLS with ALPN h2 → connection preface + SETTINGS → streams carrying HEADERS/DATA frames → flow-control windows → GOAWAY on shutdown

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
HTTP/2 per RFC 9113; nginx, Apache httpd and IIS examples.
Applicability is projected only from persisted Topic profile and Command metadata.
At a glance

Operational reference

Fast context before you go deeper.

PlatformHTTP/2 per RFC 9113; nginx, Apache httpd and IIS examples.
Scope / prerequisiteUse it on every public HTTPS site; browsers negotiate it with ALPN h2. It removes most of the need for multiple connect…
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Read-only Verification Verify boundary
# Negotiated version (prints 2 for HTTP/2)
curl -sS -o /dev/null --http2 -w "%{http_version}\n" https://www.example.com/

# ALPN result from the TLS handshake
openssl s_client -alpn h2,http/1.1 -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null | grep -i alpn
#  -> ALPN protocol: h2

# Verbose: shows "using HTTP/2" and stream activity
curl -v --http2 https://www.example.com/ -o /dev/null

No ALPN negotiated means the server (or a TLS-terminating device in front of it) does not offer h2. The origin may still speak HTTP/2 to a CDN while the CDN speaks it to clients — test each hop separately.

Step 2 Common mistakes Narrow the fault
  • Keeping HTTP/1.1 optimisations (sharding, sprites, concatenation) after enabling HTTP/2.
  • Relying on server push.
  • Expecting HTTP/2 between proxy and backend by default — most proxies speak HTTP/1.1 upstream unless configured otherwise.
  • Forgetting that a CDN negotiates HTTP/2 with clients independently of the origin.
Step 3 Troubleshooting Narrow the fault

Clients fall back to HTTP/1.1. h2 not enabled on the TLS listener, an old TLS library without ALPN, or a middlebox terminating TLS without h2.

ERR_HTTP2_PROTOCOL_ERROR in the browser. Often a response header the server or proxy sends that HTTP/2 forbids (connection-specific headers such as Connection, Keep-Alive, Transfer-Encoding), or a buffering/proxy bug. Check the server error log and whether it happens through every hop.

421 Misdirected Request. Connection coalescing sent a request for another hostname over an existing connection; serve both names consistently or use separate certificates/IPs.

Slow on lossy networks. HTTP/2 multiplexing is on one TCP connection; packet loss stalls all streams. Consider HTTP/3.

Key points

One TCP connection, many streams. Browsers only use HTTP/2 over TLS. A lost TCP packet still stalls every stream (TCP head-of-line blocking) — that is what HTTP/3 fixes. Server push is deprecated in practice; use 103 Early Hints or preload.

Key checks
  • curl -sS -o /dev/null --http2 -w "%{http_version}\n" https://<host>/ — prints 2 when h2 was negotiated.
  • openssl s_client -alpn h2 -connect <host>:443 -servername <host> </dev/null 2>/dev/null | grep ALPN — server selected h2.
  • nginx: http2 on; in the server block (1.25.1+); Apache: Protocols h2 http/1.1.
ReferenceWhat it is2 sections · depth on demand

Direct Answer

HTTP/2 (RFC 9113) sends the same HTTP requests and responses as binary frames on independent streams, so one TCP connection can carry many requests at once. Headers are compressed with HPACK, and flow control works per stream and per connection. Browsers use HTTP/2 only over TLS, negotiated with ALPN h2; cleartext HTTP/2 (h2c) is used between servers by prior knowledge. Its remaining weakness is TCP itself: one lost packet delays every stream on the connection, which HTTP/3 solves by moving to QUIC.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Framing and streams

After TLS, the client sends a connection preface and both sides exchange SETTINGS (acknowledged). Each request uses a new odd-numbered stream: a HEADERS frame, then DATA frames. Frames from different streams interleave, so a slow response no longer blocks the others at the HTTP layer.

FramePurpose
HEADERS / CONTINUATIONCompressed header block
DATABody bytes (subject to flow control)
SETTINGSConnection parameters, e.g. max concurrent streams, initial window
WINDOW_UPDATEFlow-control credit; new streams start with 65,535 bytes
RST_STREAMCancel one stream
GOAWAYGraceful shutdown or fatal error; tells the client the last stream processed
PINGLiveness and RTT

HPACK keeps a dynamic table of previously sent headers per direction, so repeated headers such as cookies and user agents shrink to a few bytes.

Negotiation

  • Over TLS: ALPN token h2 in the TLS handshake. If the server does not select it, the client uses HTTP/1.1.
  • Cleartext: h2c by prior knowledge (the client starts with the preface directly) — common for gRPC and proxy-to-backend links. The HTTP/1.1 Upgrade: h2c mechanism is deprecated.

RFC 9113 obsoletes RFC 7540 and deprecates the original priority scheme. Server push is still in the specification, but Chrome and Firefox have removed support; use 103 Early Hints or <link rel=preload> instead.

Operational consequences

  • One connection per origin: domain sharding and resource concatenation, used for HTTP/1.1, are counter-productive.
  • Connection coalescing: a browser may reuse one connection for several hostnames if they resolve to the same IP and the certificate covers them. A server that does not serve one of those names should answer 421 Misdirected Request.
  • Load balancers see fewer, longer-lived connections; balancing per connection becomes coarser.
  • The Rapid Reset attack (CVE-2023-44487, 2023) abused stream creation and RST_STREAM; keep servers patched and limit concurrent streams.

Enabling it

ServerConfiguration
nginx 1.25.1+http2 on; in the TLS server block (older versions: listen 443 ssl http2;)
Apache httpdLoadModule http2_module … and Protocols h2 http/1.1
IIS 10Enabled by default for HTTPS bindings on supported Windows Server versions
CaddyEnabled by default
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
http/2http2h2h2chpackalpn
Confirmation

Confirm action

Continue?