How HTTP works
RequiredRequired
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:
GETreads and is safe to repeat;PUTandDELETEare idempotent;POSTis neither. - Status codes by family:
2xxworked,4xxthe client must change something,5xxthe server failed. - Caching headers:
Cache-ControlandETagdecide whether a request reaches your server at all.