Andromeda
Note

HTTP Request-Response Cycle

Definition

The five-step mechanism by which a browser retrieves and assembles a web page: user initiates a URL, browser sends an HTTP request, server returns headers plus file body, browser parses HTML and fetches dependent assets, then renders the final page.

Why It Matters

This cycle is the “heartbeat” of the internet, governing how information is exchanged between clients and servers. Understanding this process is fundamental for any developer, as it is the foundation upon which all web applications, APIs, and cloud services are built.

Core Concepts

  • HTTP (HyperText Transfer Protocol): The application protocol the web uses atop the internet’s TCP/IP stack.
  • Request: Browser asks the server for a resource identified by URL.
/* Sample HTTP Request */
GET /index.html HTTP/1.1
Host: www.example.com

/* Sample HTTP Response */
HTTP/1.1 200 OK
Content-Type: text/html

<html>...</html>
  • Response Header: Contains status code and metadata (content type, caching directives).
  • Response Body: The actual HTML, image, CSS, or other file bytes.
  • Dependent Fetches: Parsing HTML triggers additional requests for linked CSS, JS, and images.
  • Common Status Codes: 200 OK (success), 301/302 redirect, 404 not found, 500 server error.

Connected Concepts