What Really Happens When You Enter a URL? Inside Browser, DNS & HTTP
From typing a URL to rendering a page, this article walks through each step—browser DNS lookup, HTTP request and response, redirects, server processing, content delivery, and asynchronous calls—revealing the complex interactions that make modern web browsing possible.
1. Enter the URL in the browser
When you type a web address, the browser receives the URL and prepares to retrieve the resource.
2. Browser looks up the domain's IP address
The first step is to resolve the domain name to an IP address via DNS. The lookup proceeds through several caches:
Browser cache – the browser stores DNS records for a short period (2–30 minutes).
System cache – if the browser cache misses, the OS is queried (e.g., gethostbyname on Windows).
Router cache – the request may be answered by the router’s DNS cache.
ISP DNS cache – the ISP’s DNS server often has the record.
Recursive search – the ISP’s DNS server performs a recursive lookup from the root to the authoritative server.
Techniques such as round‑robin DNS, load balancers, geographic DNS, and Anycast are used to distribute traffic and avoid a single IP bottleneck.
3. Browser sends an HTTP request to the web server
GET http://facebook.com/ HTTP/1.1
Accept: application/x-ms-application, image/jpeg, ...
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; ...)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: facebook.com
Cookie: datr=...; locale=en_US; ...The request includes headers that describe what the client can accept, its identity, and any cookies associated with the domain.
4. Server returns a permanent redirect (301)
HTTP/1.1 301 Moved Permanently
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Location: http://www.facebook.com/
P3P: CP="DSP LAW"
Pragma: no-cache
Set-Cookie: ...
Content-Type: text/html; charset=utf-8
X-Connection: close
Date: Fri, 12 Feb 2010 05:09:51 GMT
Content-Length: 0The browser follows the new URL and issues a second request.
5. Browser follows the redirect
GET http://www.facebook.com/ HTTP/1.1
Accept: ...
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ...)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: ...
Host: www.facebook.com6. Server processes the request
The web server software (e.g., IIS, Apache) maps the URL to a request handler such as ASP.NET, PHP, or Ruby, reads parameters and cookies, possibly accesses a database, and generates an HTML response.
7. Server sends an HTML response
HTTP/1.1 200 OK
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sat, 01 Jan 2000 00:00:00 GMT
P3P: CP="DSP LAW"
Pragma: no-cache
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
X-Connection: close
Transfer-Encoding: chunked
Date: Fri, 12 Feb 2010 09:05:55 GMT
2b3Tn@[...]The compressed payload is decompressed by the browser, revealing the HTML document that starts with a DOCTYPE declaration.
8. Browser begins rendering the HTML
Even before the entire document is received, the browser starts laying out and painting the page.
9. Browser requests embedded resources
As the HTML is parsed, the browser discovers additional URLs for images, CSS files, and JavaScript, and issues separate HTTP requests for each. These static assets are often served from a CDN (e.g., fbcdn.net) and can be cached using ETag and Cache‑Control headers.
Images – http://static.ak.fbcdn.net/rsrc.php/.../8q2anwu7.gif CSS – http://static.ak.fbcdn.net/rsrc.php/.../2plh8s4n.css JavaScript –
http://static.ak.fbcdn.net/rsrc.php/.../c8yzb6ub.js10. Browser sends asynchronous (AJAX) requests
After the page loads, JavaScript may issue background requests to keep data up‑to‑date, such as Facebook’s chat status polling. These AJAX calls follow the same request/response cycle, often using long‑polling to reduce server load.
Summary
Understanding each of these steps—DNS resolution, HTTP negotiation, redirects, server‑side processing, content delivery, and asynchronous communication—helps developers diagnose performance issues and design more efficient web applications.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
