Module 1 · Lesson 1 Preview Beginner

HTTP Essentials

10 min read

Why HTTP Matters for CDNs

Before CDNs, we need a shared view of HTTP. HTTP is the protocol that powers the web. HTTP sits at the heart of every CDN. This is not a full HTTP course. But these basics matter for CDNs.

Here's the key insight: CDNs are HTTP-aware caches. They act on HTTP methods, headers, and status codes. If you understand these, you understand how to control CDN behavior.

The Request-Response Cycle

HTTP runs on requests and responses. A client sends a request. Usually that is a browser. The server sends back a response. Every web call follows this pattern:

  • Client sends request — "Give me this resource"
  • Server processes. It finds or makes the resource.
  • Server sends response. The resource, or an error.
  • Connection closes. Or it stays open for reuse.

HTTP is stateless. Each request stands alone. The server forgets past requests. Unless you pass state along, like cookies or tokens. The server keeps no memory of past talks.

HTTP Methods

HTTP methods, or "verbs," say what the client wants to do:

Method Purpose Cacheable? Safe?
GET Gets a resource from the server Yes Yes
POST Sends data to create a resource Rarely No
PUT Replaces the whole resource No No
PATCH Updates part of a resource No No
DELETE Removes a resource No No
HEAD GET with no response body Yes Yes
OPTIONS Lists the allowed methods No Yes
Common HTTP Methods

Safe means the method does not change server state. It only gets data. Cacheable: the reply can be stored and reused. Both rules shape what CDNs store.

Anatomy of a Request

TEXT
GET /api/products/123 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
Accept: application/json
Accept-Encoding: gzip, br
Cache-Control: no-cache
Example HTTP Request

A request has three main parts:

  • Request line — Method, path, and HTTP version
  • Headers. Info about the request, like Host and Accept.
  • Body. Optional data sent with POST or PUT.

Anatomy of a Response

TEXT
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 45
Cache-Control: public, max-age=3600
ETag: "abc123"
Age: 120

{"id": 123, "name": "Widget", "price": 29.99}
Example HTTP Response

A response has three main parts:

  • Status line — HTTP version, status code, and reason phrase
  • Headers. They describe the response, like Content-Type and Cache-Control.
  • Body. The real content, like HTML, JSON, or images.

Status Codes

Status codes tell you what happened with your request. The first digit sets the group. They're grouped by first digit:

Range Category Common Examples
1xx Informational 100 Continue. 101 Switching Protocols.
2xx Success 200 OK. 201 Created. 204 No Content.
3xx Redirection 301 Moved Permanently. 304 Not Modified.
4xx Client Error 400 Bad Request. 401 Unauthorized. 404 Not Found.
5xx Server Error 500 Internal Server Error. 502 Bad Gateway. 503 Service Unavailable.
HTTP Status Code Families

Headers: The Control Plane

Headers are key-value pairs. They steer HTTP behavior. For CDNs, certain headers are critical:

Header Direction Purpose
Cache-Control Response Primary caching directives. We'll cover these later.
ETag Response Version identifier for conditional requests.
Vary Response Which request headers affect caching.
Age Response Seconds since the origin made the reply.
If-None-Match Request Conditional GET with ETag.
Host Request Which origin to contact.
CDN-Critical Headers (Preview)

Module 3 (Headers & Configuration) covers each one in depth. For now, know that headers control CDN caching. Headers are the main control you have.

HTTP Versions

You'll encounter different HTTP versions:

  • HTTP/1.1. Still widely used. Text-based. One request at a time over a reused connection.
  • HTTP/2. Binary. Many requests share one connection. Header compression built in.
  • HTTP/3. Uses QUIC instead of TCP. Better on unreliable networks.

Caching rules are the same in all versions. Only the transport changes. CDNs typically support these versions and let you choose which to expose. All three work the same for caching.

HTTP/2 HTTP/3

Key Takeaway

Quick Check

Which HTTP methods do CDNs typically cache?

Correct! Not quite.
Explanation

GET and HEAD only fetch data.

They do not change server state.

So CDNs cache them safely.

Methods that write, like POST, go to the origin.

Quick Check

What does the status code 304 mean?

Correct! Not quite.
Explanation

304 Not Modified means the stored copy is valid.

The origin told the cache to keep using it.

No body is sent, so bandwidth is saved.

Enjoying this preview?

Unlock all lessons, hands-on exercises, and earn your CDN certification.

Get Full Access

Ready to Master CDN?

You've just scratched the surface. Create a free account to access the full course, hands-on exercises, and earn your CDN Certified credential.

Free intro module Track progress Certificate

No credit card required · Free forever tier available