How an HTTP Request Works
What actually happens between typing a URL and seeing a page.
Loading a web page is a relay of protocols stacked on each other. Peeling them apart shows exactly why a slow site is slow — and where the time actually goes.
Legend — how to read this diagram
The full pipeline
- DNS. Resolve the hostname to an IP address.
- TCP. Open a reliable connection with the three-way handshake.
- TLS. Negotiate encryption if the URL is HTTPS.
- Request. Send a method, path, and headers (
GET /index.html). - Response. The server returns a status code, headers, and body.
- Render. The browser parses HTML, fetches assets, and paints pixels.
Where the time goes
Round trips dominate. Each handshake is a full trip; HTTP/2 and HTTP/3 cut them down.
Status codes tell the story. 2xx success, 3xx redirect, 4xx your fault, 5xx server's fault.
Caching short-circuits it. Cache headers can skip most of the pipeline on repeat visits.
A web request is a stack of protocols, each solving one problem — name, connection, encryption, content, pixels.
No comments:
Post a Comment