Understanding the Path of a Web Request: Browser to Website Explained



This content originally appeared on DEV Community and was authored by CodeWithMishu

The Magic Behind Every Website Visit

Ever wonder what happens in the 2-3 seconds between typing “google.com” and seeing the page? What looks like simple browsing is actually a sophisticated orchestration of technologies working together. Let’s unpack this journey step by step.

Phase 1: The Domain Name Translation (DNS)

graph LR
    A[Browser] --> B[Local DNS Cache]
    B --> C[Recursive Resolver]
    C --> D[Root Nameserver]
    D --> E[TLD Nameserver .com]
    E --> F[Authoritative Nameserver]
    F --> G[IP Address]
  1. Local Cache Check: Your browser first checks its cache: “Have I visited this site recently?”

  2. OS & Router Check: If not found, your operating system and router check their caches

  3. Recursive Resolver: Your ISP’s DNS server takes over the search

  4. Root Nameserver: Directs query to the proper Top-Level Domain (TLD) server (.com, .org, etc.)

  5. Authoritative Nameserver: The final stop that holds the actual IP address for the domain

This entire DNS resolution process typically happens in under 100ms!

Phase 2: Establishing Connection (TCP/TLS)

Once we have the IP address, the real conversation begins:

  1. TCP Handshake:
* Client: "Can we talk?" (SYN)

* Server: "Let's talk!" (SYN-ACK)

* Client: "Okay!" (ACK)
  1. TLS Handshake (for HTTPS):
* Server sends SSL certificate

* Client verifies certificate authenticity

* Secure encrypted tunnel established

Phase 3: The HTTP Request-Response Cycle

sequenceDiagram
    Browser->>Server: HTTP GET Request
    Server->>Browser: HTTP Response (Status Code + Headers)
    Browser->>Server: Request for Assets (CSS/JS/Images)
    Server->>Browser: Sends Assets
  • Browser sends HTTP request with headers (user agent, accepted formats, cookies)

  • Server processes request (hits application logic, databases, etc.)

  • Server responds with:

    • Status code (200 OK, 404 Not Found, etc.)
    • Headers (content type, caching instructions)
    • Response body (HTML content)

Phase 4: Browser Rendering Engine Takes Over

  1. Construct DOM Tree: Parses HTML into object model

  2. CSSOM Construction: Processes CSS styling

  3. Render Tree: Combines DOM + CSSOM

  4. Layout: Calculates element positions

  5. Paint: Pixels hit the screen

Why This Matters to Developers

Understanding this workflow helps with:

  • Debugging network issues (failed DNS? stalled TCP?)

  • Performance optimization (reduce DNS lookups, leverage HTTP/2)

  • Security hardening (proper TLS configuration, HSTS headers)

  • Infrastructure design (CDN placement, caching strategies)

The Bigger Picture

What’s fascinating is this entire process:

  • Occurs across multiple continents

  • Involves dozens of independent systems

  • Happens in less time than a human blink (300-400ms for major sites)

  • Repeats billions of times per minute globally

Visualizing the Journey

While this article covers the fundamentals, sometimes seeing the process in action helps cement understanding. I’ve created an animated explainer that demonstrates each step visually:

How Websites Work - Visual Explanation

Discussion Question: What part of web infrastructure still mystifies you? Share your thoughts below! 👇


This content originally appeared on DEV Community and was authored by CodeWithMishu