Web Development
Lesson 4 of 4 8 min +55 XP

HTTP & How the Web Works

What happens when you load a page.

What you'll learn

  • Describe the request/response cycle
  • Read common HTTP status codes
  • Explain client vs. server roles
Ordering at a restaurant

You (the browser) ask the waiter (a request) for a dish, the kitchen (the server) prepares it, and the waiter brings it back (the response). Loading a web page is that exchange — HTTP is the polite language browser and server use to place and fill the order.

Request, then response

The web runs on HTTP. Your browser (the client) sends a request to a server — a method (GET to fetch, POST to send data) plus a URL. The server replies with a response: a status code, headers, and usually a body (the HTML, JSON, or image). This request/response cycle repeats for every resource on a page.

Status codes in families

2xx = success (200 OK), 3xx = redirect, 4xx = client error (404 Not Found), 5xx = server error (500). The first digit tells you the category at a glance.

Visiting a page: GET /index.html → 200 OK with the HTML; the browser then GETs each image and script it references.
Lab · Read the code
  1. A request for a missing page comes back with status 404.
  2. Identify which family 4xx belongs to.
  3. State whose 'fault' the error indicates.

What you should see: 404 is a 4xx client error — the client asked for something that isn't there; the server itself is working fine.

Knowledge Check

+15 XP / correct

1. Which HTTP method is normally used to fetch a page?

2. An HTTP status in the 5xx range indicates…