The HTTP Request Lifecycle: DNS Lookup, TCP Connection, Request, Response

~13 min read

Every HTTP request goes through the same four stages: find the server's address (DNS), open a reliable connection (TCP), send the request, and receive the response — worth understanding since each stage is a place things can be slow or fail.

The HTTP Request Lifecycle: DNS Lookup, TCP Connection, Request, Response is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AI Engineering curriculum.

Key points

  • DNS lookup translates a human-readable name (google.com) into a numeric IP address — the very first stage, since you can't connect without an address
  • TCP connection establishment guarantees reliable, in-order delivery via a handshake; HTTPS adds a further TLS handshake to negotiate encryption
  • The HTTP request stage sends the method, path, headers (including auth), and body — the actual 'what do you want' from the REST fundamentals subtopic
  • The HTTP response stage returns status code, headers, and body, which the client then parses (render HTML, or parse JSON for an API call)
  • Each stage is a real source of latency — DNS delays, fresh TCP/TLS handshakes — which is why connections are often reused across multiple requests instead of reconnecting each time