Track 01 · Lesson 6 of 9How the web works
HTTP under the hood
Lesson 6 of 9· 8 min
HTTP has changed a lot underneath while looking the same on top. Methods, headers and status codes are identical in HTTP/1.1, 2 and 3. What changed is how requests travel: how many connections, how many round trips, and what happens when a packet goes missing.
The same page, three protocols
Change the latency, then lose a packet
Thin line: waiting for the first byte · bar: downloading. A simplified model, but the shape is real.
HTTP/1.1
1260 ms
HTTP/2
885 ms
HTTP/3
785 ms
Round trips are the real cost#
Before the first byte of a page, the browser needs a TCP handshake and a TLS handshake: two round trips. On a 300 ms mobile link, that’s more than half a second of nothing. HTTP/3 runs on QUIC, which does both in one round trip, and resumes known connections even faster.
Multiplexing, and its weak spot#
HTTP/1.1 sends one request at a time per connection, so browsers open about six connections per site and files queue behind each other. HTTP/2 sends every request over one connection at once. But HTTP/2 still runs on TCP, which delivers bytes strictly in order: one lost packet holds up every stream until it’s resent. QUIC delivers each stream independently.
You don’t write anything differently for HTTP/2 or 3: your host or CDN turns them on. What changes is old advice. Bundling everything into one giant file, or spreading files across many domains, were workarounds for HTTP/1.1 limits.
Compression#
Text compresses extremely well, because it repeats itself. The browser lists what it can unpack in Accept-Encoding; the server picks one and says so in Content-Encoding.
Compress it for real
Your browser does the compressing
The request says what it can unpack
GET /products HTTP/2 Accept-Encoding: gzip, deflate, br, zstd
The response says what it used
HTTP/2 200 Content-Type: application/json Content-Encoding: gzip Vary: Accept-Encoding
// Browsers also speak br (Brotli) and zstd, which squeeze text a bit further.
// Your host or CDN usually compresses for you; check the response's Content-Encoding in DevTools.Check yourself