How HTTP works

RequiredRequired

Juan Camilo ZúñigaBackend & data developer

HTTP is a request/response protocol: the client sends a method, a path, headers and an optional body; the server answers with a status code, headers and an optional body. Each request stands alone, so anything the server must remember (a session, a cart) travels in headers like Cookie or Authorization.

What to learn first

  • Methods and their promises: GET reads and is safe to repeat; PUT and DELETE are idempotent; POST is neither.
  • Status codes by family: 2xx worked, 4xx the client must change something, 5xx the server failed.
  • Caching headers: Cache-Control and ETag decide whether a request reaches your server at all.