The request and response cycle
Here is the dance, start to finish. You type an address, and behind the scenes this happens in a fraction of a second:
CLIENT (your browser) SERVER (in a data center)
| |
| 1. REQUEST |
| "GET /products/shoes" ------------------> |
| | 2. server thinks:
| | looks up the shoes,
| | builds the page
| |
| 3. RESPONSE |
| <------------------ "200 OK + the page" |
| |
4. browser draws |
the page on screen |
| |
Four steps, every time:
- The client sends a request to a URL.
- The server processes it — maybe it looks something up, runs some logic, checks who you are.
- The server sends back a response: a status (did it work?) plus some content (the page, an image, some data).
- The client does something with the response — usually, draws it on your screen.
Loading one web page isn't one request — it's dozens. The browser asks for the page, then sees it needs images, fonts, and styles, and fires off a fresh request for each. Same dance, many times, very fast.