← Lessons HTTP, step by step
0 / 3 units
中文
Lesson 1

What happens when you open a web page?

Follow one request from your browser to a server and back. Then try each HTTP method against a live mock API and test yourself. Use the Beginner / Advanced switch at the top to change how deep the explanations go.

Unit 1

The request journey

The big picture. Opening a web page is like phoning a shop to order something:
  1. Look up the shop's phone number. (DNS)
  2. Dial and wait until someone picks up. (TCP)
  3. Check it's really that shop, then switch to a private line. (TLS)
  4. Say what you want. (HTTP request)
  5. The shop gets it ready. (server processing)
  6. They hand it over with a note saying "OK". (HTTP response)
  7. You unpack it, notice a few missing pieces and ask for those too. (render)
Under the hood. One page load goes through four protocol layers. Each layer relies on the one below it:
HTTPMethods, headers, status codes. HTTP/1.1 and h2 run over TLS + TCP; HTTP/3 runs over QUIC.
TLS 1.3Encryption and proof of the server's identity. Certificates, ECDHE, ALPN.
TCPA reliable, ordered stream of bytes. Replaced by QUIC (over UDP) in HTTP/3.
IPMoves packets to an address. DNS turns names into these addresses.

Press Play to watch the whole trip, or click a stage to replay just that part.

no connection yet Browser DNS Server

On the wire
Unit 2

HTTP methods

The method is the verb of a request: it says what you want to do to a resource. Below is a tiny bookshelf API. Pick a method, press Send, and watch what happens to the server's data. Press Send twice to see which methods are idempotent.

Safe = only reads, never changes data. Idempotent = doing it twice has the same effect as doing it once.

Client
Server
Request
Response
(press Send)
Server data: /api/books
idtitleread
Unit 3

Check yourself