HTTP
HyperText Transfer Protocol — the protocol the web runs on. Every web request and response uses HTTP. It's a request-response protocol: a client (browser) sends a request, a server returns a response. HTTP/2 and HTTP/3 added multiplexing and faster transport.
Tim Berners-Lee · Invented HTTP at CERN in 1989
- All web communication.
- APIs (REST, GraphQL over HTTP).
- Real-time bidirectional (use WebSockets).
- Binary streaming at high throughput (use gRPC).
Definition
HTTP is a stateless, request-response application protocol. Requests have a method (GET, POST, PUT, DELETE), URL, headers, and optional body. Responses have a status code (200, 404, 500), headers, and body. HTTP/2 multiplexes over one connection; HTTP/3 runs over QUIC.
Why it exists
To provide a simple, extensible way for clients and servers to exchange documents and data over the internet, forming the foundation of the web.
How it works
Client opens a TCP (HTTP/1.1, HTTP/2) or UDP (HTTP/3) connection, sends a request line + headers + body. Server processes and returns a status + headers + body. Headers carry metadata (content type, caching, auth). Cookies add state across requests.
Scaling limits
HTTP/1.1 opens one connection per request (slow); HTTP/2 multiplexes. Headers are text (HTTP/3 compresses them). Stateless means auth/state must be in cookies or tokens.
Cost shape
Free protocol. The cost is TLS, connection management, and payload size.
Alternatives
- WebSockets — Bidirectional, persistent connection for realtime.
- gRPC — Binary, typed, streaming — for internal RPC.
Failure modes
- No built-in state (cookies/tokens needed).
- Header bloat on HTTP/1.1.
- CORS misconfiguration blocking requests.