DEV Community

Cover image for Understanding the Journey of a Web Request
Nelisa Dludla
Nelisa Dludla

Posted on

Understanding the Journey of a Web Request

"What happens when you type https://www.google.com in your browser and press Enter?"

Disclaimer: This post is meant for those who have started to learn about web infrastructure components and help them make sense of it all.

Introduction

When we enter the URL "https://www.google.com" into our browser and press Enter, there are a number of events that happen before you are greeted with Google's search bar on the homepage.

1. DNS Request:
It all starts with a DNS (Domain Name System) request. When we enter a URL into our browser, our browser needs to translate the URL, which is the human-readable version of an IP address, back to an IP address. The DNS server responses with the corresponding IP address for Google's servers.

2. TCP/IP:
Now that the browser knows the IP address of the server, it establishes a TCP (Transmission Control Protocol) connection. TCP ensures reliable and an ordered delivery of data packets between the client (our browser) and the server (Google's).

3. Firewall:
Before the connection is established, it may have to go through a firewall. Firewalls act as a barrier between our PCs and the internet, by filtering out potential harmful traffic and only allowing authorized connections.

4. HTTPS/SSL:
In the URL "https://www.google.com", "https://" (specifically the s) indicates that a secure connection using SSL (Secure Sockets Layer) or its successor, TLS (Transport Layer Security), is required. This protocol provides a layer of encryption that ensures that the data exchanged between the client and server is encrypted, protecting it from potential hackers.

5. Load-Balancer:
Load balancers distribute incoming requests across Google's multiple servers. They help optimize performance and ensure high availability by evenly distributing the traffic and redirecting requests to healthy servers.

6. Web Server:
When the request finally reaches Google's servers, it is first handled by a web server such as Apache or Nginx. The web server will process the request, retrieve the requested resources (like the Google Homepage), and then return an HTTP response.

7. Application Server:
For dynamic content, the request will be passed to an application server. The server executes the necessary back-end code in order to generate the requested content.

8. Database:
In some cases, the application server needs to communicate with a database to retrieve or store data. For example, when searching on Google, the application server will query a database to fetch the relevant results.

Conclusion

From the initial DNS request to the final database interaction, the web request involves a number of different components working together to deliver the requested content to your browser.

I hope this blog has somehow managed to painted a picture in your mind as to how a web infrastructure functions to produce the many web pages we interact with on a daily.

Top comments (0)