GOAT EngineerPreparing your learning space…

System Design · Concept Library · Free article

HTTP

The request-and-response protocol of the web: methods, status codes, headers, and stateless semantics.

HTTP defines request and response semantics for the web. A request names a method and target; a response returns a status and optional content. HTTP is stateless in the sense that each request can be understood on its own. Applications may still use server-side sessions; to let any healthy server handle the next request, that state must be shared, client-carried, or deliberately routed.

A request, and a reply

After the browser has an address and a secure connection, it can state what it wants. HTTP defines that exchange: the client sends a request and the server returns a response.

Anatomy of a request and response

The familiar HTTP/1.1 wire format is textual; HTTP/2 and HTTP/3 carry the same semantics in binary frames. The conceptual request and response shape remains useful across all three. Pick a method and watch both sides change:

The interactive version of this example is available when JavaScript loads.

Methods and what they promise

The method is the verb. Two properties matter: safe means the client did not request a state change; idempotent means repeating the same request has the same intended effect on the server. Responses and incidental effects such as logging can still differ.

MethodMeansSafe?Idempotent?
GETRead somethingYesYes
POSTCreate something newNoNo
PUTReplace somethingNoYes
PATCHPartly update somethingNoNot necessarily
DELETERemove somethingNoYes

Status codes that matter

Every response carries a three-digit status code, and the first digit tells you the category at a glance:

RangeMeansYou will see
2xxIt worked200 OK, 201 Created
3xxGo somewhere else301/302 redirect
4xxThe request cannot be fulfilled as sent404 Not Found, 401 Unauthorized, 429 Too Many Requests
5xxThe server failed while handling an apparently valid request500 Server Error, 502 Bad Gateway

Headers: the flexible extras

Headers are key-value pairs that travel alongside the request and response, carrying everything that is not the main content: what type the body is, how to cache it, who is asking, and more.

A few you will run into

  • Content-Type: what the body is (JSON, HTML, an image).
  • Cache-Control: whether and how long this may be cached.
  • Authorization: proof of who is making the request.

Statelessness: why it scales

HTTP is stateless: its semantics do not require one request to remember an earlier request on the connection. That does not prohibit application sessions or server-side state.

To make servers interchangeable, the application can put session state in a shared store or signed client token, or route a session deliberately. With that extra architectural choice, any healthy server can handle the next request.

HTTP 1.1 → 2 → 3, briefly

VersionThe big changeWhy it helped
HTTP/1.1Persistent connections and optional pipeliningPipelining saw limited deployment; responses still preserve request order.
HTTP/2Multiplexed streams over one TCP connectionRemoves HTTP-level queueing, though TCP loss can still stall all streams.
HTTP/3HTTP semantics over QUIC and UDPA lost packet on one stream does not block delivery on other streams.

Where HTTP sits

HTTP sits at the application layer, often called Layer 7. A Layer 7 load balancer can inspect the HTTP path and headers, while a lower-layer balancer routes using network and transport information. See network layers.

What to remember

Sources and further reading

By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.