Lesson 2
The HTTP conversation
See how requests and responses form the web’s simple, powerful conversation.
HTTP is the language browsers and web servers use to exchange messages. Its core pattern is deliberately simple: a client sends a request, and a server returns a response.
A request has intent
GET /courses/web HTTP/1.1
Host: learn.staticvar.dev
Accept: text/html
The method GET says what the client intends to do. The path identifies the resource. Headers add context such as the desired response format.
A response reports an outcome
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 4280
<!doctype html>...
The status code summarizes what happened. 200 means success, 404 means the resource was not found, and 500 means the server encountered an error.
flowchart LR
A[Browser] -->|Request| B[Web server]
B --> C{Can it fulfill it?}
C -->|Yes| D[2xx response]
C -->|Redirect| E[3xx response]
C -->|Client issue| F[4xx response]
C -->|Server issue| G[5xx response]The important boundary
HTTP does not say how a server must produce its response. The bytes might come from a static file, a database-backed application, a cache, or another service. From the browser’s perspective, the contract is the same.
Finished this lesson?
Your progress stays only in this browser.