Sitemap

Demystifying the Journey of a Web Request: From URL Entry to Content Delivery

3 min readApr 14, 2024

Have you ever wondered what happens behind the scenes when you type a URL into your browser and hit Enter? The process may seem simple on the surface, but under the hood, it involves a complex orchestration of technologies and protocols working seamlessly together to deliver the web page you requested. In this article, we’ll take a deep dive into the journey of a web request, covering everything from DNS resolution to content delivery.

DNS Request

The journey begins when you type a URL like https://www.google.com into your browser’s address bar and press Enter. Before initiating a DNS request to a DNS server, the browser first checks its own cache to see if it has previously resolved the domain name to an IP address. This cache helps improve performance by avoiding unnecessary DNS lookups for frequently visited websites. Additionally, the operating system maintains its own DNS cache, which the browser may also check before sending a DNS request.

If the domain name is found in either the browser’s cache or the operating system’s cache, the DNS resolution process can be skipped, and the corresponding IP address is retrieved immediately. However, if the domain name is not found in the cache, the browser sends a DNS request to a DNS server to translate the human-readable domain name into an IP address. This process involves querying authoritative DNS servers until the IP address associated with the domain name is found.

TCP/IP

Once the browser obtains the IP address of the destination server, whether from its cache or through DNS resolution, it initiates a TCP (Transmission Control Protocol) connection to establish communication. TCP ensures reliable, ordered, and error-checked delivery of data packets over the Internet. The browser sends a request to the destination server using the HTTP or HTTPS protocol, which operates over TCP/IP.

Firewall

The request passes through any firewalls that may be present in the network infrastructure. Firewalls act as a barrier between a trusted internal network and untrusted external networks, filtering network traffic based on predetermined security rules.

HTTPS/SSL

If the URL begins with “https://” (Hypertext Transfer Protocol Secure), it means the communication between the browser and the server is encrypted using SSL/TLS (Secure Sockets Layer/Transport Layer Security) protocols. SSL/TLS encryption ensures that data transmitted between the client and server remains confidential and secure from eavesdroppers.

Load-Balancer

In large-scale web applications, incoming traffic is often distributed across multiple servers to improve performance and reliability. Load balancers sit between the client and the server farm, distributing incoming requests across multiple servers based on factors such as server health and current load.

Web Server

Once the request reaches the appropriate server, typically a web server (e.g., Apache, Nginx), the server processes the request. It retrieves the requested resources, such as HTML files, images, or scripts, and prepares them for delivery back to the client.

Application Server

In dynamic web applications, the web server may pass the request to an application server (e.g., Tomcat, Node.js) to perform additional processing. Application servers execute the business logic of the application, interacting with databases, processing user input, and generating dynamic content.

Database

If the requested resource requires data from a database, the application server queries the database to retrieve the necessary information. The database server processes the query, retrieves the requested data, and returns it to the application server.

Content Delivery

Finally, the web server or application server constructs the HTTP response containing the requested resources and sends it back to the client over the established TCP connection. The browser receives the response, renders the HTML, executes any JavaScript code, and displays the web page to the user.

The image above illustrates the DNS resolution process, showing how the browser queries DNS servers to translate a domain name into an IP address.

In conclusion, the journey of a web request involves multiple stages, from DNS resolution to content delivery, each facilitated by various technologies and protocols. Understanding this process provides insights into the inner workings of the web and empowers developers and engineers to optimize performance, security, and reliability in web applications.

--

--

No responses yet