Fundamentals 16 min read

What Really Happens When You Type a URL? A Deep Dive into DNS, HTTP, and Browser Rendering

This article walks through the complete lifecycle of a web request—from entering a URL, DNS resolution, and HTTP communication, to server processing, HTML delivery, resource fetching, and AJAX interactions—explaining each step with diagrams and code examples.

Efficient Ops
Efficient Ops
Efficient Ops
What Really Happens When You Type a URL? A Deep Dive into DNS, HTTP, and Browser Rendering

As a software developer you need a layered understanding of how web applications work, including browsers, HTTP, HTML, web servers, and request handling.

1. Enter the URL in the browser

2. Browser looks up the domain’s IP address

The DNS lookup proceeds through several caches: browser cache, OS cache, router cache, ISP DNS cache, and finally recursive search from the root to the authoritative server.

Browser cache – stores DNS records for a short time (2‑30 minutes).

System cache – queried via system calls like

gethostbyname

.

Router cache – routers often keep their own DNS entries.

ISP DNS cache – the ISP’s DNS server may already have the record.

Recursive search – the ISP’s server walks the DNS hierarchy from the root to the domain’s authoritative server.

3. Browser sends an HTTP request to the web server

<code>GET http://facebook.com/ HTTP/1.1
Accept: ...
User-Agent: Mozilla/4.0 ...
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: facebook.com
Cookie: ...</code>

The request includes the target URL, headers such as

Accept

,

User-Agent

, and any cookies stored for the domain.

4. Server returns a permanent redirect (301)

<code>HTTP/1.1 301 Moved Permanently
Cache-Control: private, no-store, no-cache, must-revalidate, pre-check=0
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Location: http://www.facebook.com/
...</code>

The redirect consolidates URLs (e.g., with and without

www

) for better SEO and caching.

5. Browser follows the redirect

<code>GET http://www.facebook.com/ HTTP/1.1
Accept: ...
Accept-Language: en-US
User-Agent: Mozilla/4.0 ...
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: ...
Host: www.facebook.com</code>

6. Server processes the request

The web server software (e.g., IIS, Apache) maps the URL to a request handler (ASP.NET, PHP, Ruby, etc.) which reads parameters, accesses databases, and generates an HTML response. Large sites use techniques such as sharding, replication, and batch processing to handle data at scale.

7. Server sends an HTML response

<code>HTTP/1.1 200 OK
Cache-Control: private, no-store, no-cache, must-revalidate, pre-check=0
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
...</code>

The body is compressed with gzip; after decompression the browser receives the full HTML document.

8. Browser begins rendering HTML

9. Browser fetches embedded resources

For each

&lt;img&gt;

,

&lt;link rel="stylesheet"&gt;

, and

&lt;script&gt;

tag, the browser repeats the DNS lookup, request, and possible redirects, but static assets are often cached and may include ETag validation.

10. Browser sends asynchronous (AJAX) requests

After the page loads, JavaScript can issue background HTTP requests (e.g., to fetch chat status). These AJAX calls may use long polling or other techniques to receive server‑push updates despite HTTP being request‑response.

Overall, the process demonstrates how browsers, DNS, HTTP, servers, CDNs, and asynchronous communication cooperate to deliver modern web experiences.

HTTPDNSbrowser renderingAJAXweb fundamentals
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.