Lesson 10 of 13 · 20m
A Request Is a Contract
DNS, TLS, and the handshake behind every URL — why domain sharding died with HTTP/2, what status codes actually promise, and the headers that run caching.
Type a URL, press Enter, and in under a second a page appears. What actually happened: the URL was parsed, the hostname resolved via DNS (probably from a cache — or DNS-over-HTTPS, which changes who gets to see your lookups), a connection opened to the server, TLS negotiated, and an HTTP request went down the wire. Everything after — status codes, headers, caching — is the server's half of a contract your browser already signed.
The connection is a negotiation
Under HTTP/1.1 (RFC 2616, June 1999; rewritten as RFC 9112 in 2022), the browser opens a TCP connection, then TLS — TLS 1.3 (RFC 8446, August 2018) finishes its handshake in one round trip where TLS 1.2 took two. Then plain request bytes: a request line, headers, a blank line, a body.
Here's the part that shaped fifteen years of web ops: browsers cap at roughly six simultaneous TCP connections per host. That limit is a convention, not a spec — and the entire "domain sharding" industry, assets split across static1./static2./static3. for parallelism, existed to route around it.
HTTP/2 (RFC 9113) put multiple request streams on a single connection — multiplexing, real prioritization, header compression. No more connection cap. And it flipped domain sharding from best practice to self-sabotage overnight: extra hostnames now mean extra DNS lookups and TLS handshakes, defeating the point. If you inherit a sharded asset config, collapse it.
HTTP/3 (RFC 9114, June 2022) swapped TCP for QUIC over UDP — TLS built in, no transport-level head-of-line blocking. It already carries a large share of real traffic; the DevTools network panel shows h3 in the Protocol column when it's live.
The response is a contract too
curl -v is the ground truth — run it once:
curl -sv https://example.com -o /dev/nullYou'll watch the TLS handshake, then > GET / HTTP/2, then < HTTP/2 200 plus the headers. Those headers are the contract:
Cache-Control— the one that matters.no-cachedoes not mean "don't cache"; it means "store, but revalidate every time."no-storemeans don't store.max-age=31536000, immutablemeans "never ask again" — that is what fingerprintedapp.a1b2c3.jsassets get.ETag/If-None-Match— conditional requests. The browser sends the stored ETag;304 Not Modifiedcomes back with no body, saving the transfer.Content-Type— the browser trusts it over the file extension, which is why a script served astext/plainnever executes — and whynosniffexists.Locationwith 301/302/307/308 — redirects. 307 and 308 preserve the method and body; a 301 historically let clients downgrade a POST to a GET.
Status codes are load-bearing
fetch does not reject on 404 or 500 — the response arrived, so the promise resolves; res.ok (status 200–299) is the check you write. A 304 means "your cache is still good." A 503 from a CDN is not your origin down — it's the edge, and Server: or CF-RAY headers tell you which.
The headers worth memorizing
Accept-Encoding: br, zstd— the browser's offer; Brotli and Zstandard beat gzip on text. If your server ignores it, you ship uncompressed.Vary— which request headers differentiate the cached response.Vary: Accept-Encodingis mandatory; a missingVaryis how a compressed body poisons a cache entry for a client that can't read it.Priority/u=— HTTP's extensible prioritization header (RFC 9218); the polite way to say "this resource matters more than that one."Link: <...>; rel=preloadand103 Early Hints— pushing critical resources before the HTML finishes generating.
DNS details for the curious: A/AAAA records map names to IPs, CNAME aliases one name to another — and a CNAME can't sit at the zone apex, which is why providers invented ALIAS/ANAME flattening.
Try it yourself
// Response is a real Fetch API constructor — the same object fetch resolves with.
const res = new Response("Non-blocking is better than blocking.", {
status: 200,
headers: { "content-type": "text/plain" },
});
console.log(res.status, res.ok, res.headers.get("content-type"));
// A 404 resolves exactly the same way — ok:false is the only flag.The practice
Learn curl -v, curl -I, and the DevTools network panel before any other debugging skill. Check Cache-Control before you blame a stale cache, read Server: before you blame the origin, and check res.ok before you parse.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Building a Modern App With React, Vite, and Tailwind CSS: The Complete 2025 Guide
React for the UI, Vite for the build tooling, Tailwind for the styles. This is the stack most new frontend projects start with in 2025. This guide wires all three together from scratch and builds a real application structure you can actually start a production project from.
What is Tailwind CSS? The Utility-First CSS Framework Developers Either Love or Hate
Tailwind is a utility-first CSS framework. You style elements by stacking single-purpose class names directly in your markup. Half the dev community hated this idea, then started using it. Here's why it works and what you need to know.
What is Vite? The Build Tool That Made Frontend Development Fast Again
Vite replaced Webpack for a lot of teams without much fanfare. Native ES modules, a dev server that starts in milliseconds, and a production build that doesn't require understanding 300 lines of config. Here's how it works and why the switch is worth it.
What is React? The JavaScript Library That Changed Frontend Development
React is a JavaScript library for building user interfaces. Facebook built it in 2013, open-sourced it, and the entire frontend ecosystem reorganized itself around it. Here is how the component model works, why it took over, and what you need to know before writing a single line.