Menu
Web · 02 Topic · 9 steps

How HTTP works

“From typing a URL to getting a page back, one step at a time.”

Every time you open a website, call an API or load an image, your computer speaks HTTP. It’s a small, text-based language, and once you can read it, a lot of “web magic” stops being magic.

This guide builds it up piece by piece. Each page explains one idea with examples you can run yourself.

You’ll learn:

  • what actually happens between typing a URL and seeing a page
  • how to read and write HTTP requests and responses by hand
  • what methods, headers and status codes mean, and when to use which
  • how to build a tiny HTTP server with no libraries

You’ll need: a terminal with curl (already on macOS and Linux) and, for the last part, Node.js.

Start reading →
Byte card for How HTTP works: HTTP is plain text: a client sends a request, the server sends one response. A URL is scheme, host, port, path, query and fragment. The fragment stays in the browser. The method says what to do: GET reads, POST creates, PATCH edits, DELETE removes. Headers carry the extras: Content-Type, Accept, Authorization and cookies. Status codes by first digit: 2xx worked, 3xx look elsewhere, 4xx your mistake, 5xx theirs.

Byte card

The whole topic on one card

  1. HTTP is plain text: a client sends a request, the server sends one response.
  2. A URL is scheme, host, port, path, query and fragment. The fragment stays in the browser.
  3. The method says what to do: GET reads, POST creates, PATCH edits, DELETE removes.
  4. Headers carry the extras: Content-Type, Accept, Authorization and cookies.
  5. Status codes by first digit: 2xx worked, 3xx look elsewhere, 4xx your mistake, 5xx theirs.

Save it as a cheat sheet, or share it with someone who's learning this too.

Search posts and bytes

Optional account

Keep your progress everywhere

Everything on AminBytes is free to read, with or without an account. Sign in only if you want your commits, streak and merged topics saved, on every device.

or

We keep only your name, avatar and which bytes you finished, and you can delete it all anytime. Privacy