What happens when you hit Enter after typing a website address?

A Journey to discover what happens behind the scenes when our browser tries to access google.com

Gabriel Simon Tagbor
9 min readJul 24, 2023

Imagine for a moment the anticipation that fills your mind as you type the address of your favourite website and hit that Enter key. It’s a split-second action, but behind it lies a captivating tale of technology in motion. It’s a story of data travelling across vast distances, of servers working to deliver the content you seek, and of the intricate protocols that govern our online interactions.

In this blog post, we embark on a thrilling journey behind the scenes, pulling back the curtain to reveal the hidden secrets of what happens when you hit Enter after typing a website address.

We’ll start by unravelling the concept of DNS requests, where website addresses are transformed into numerical codes technically referred to as IP addresses. Then, we’ll dive into the robust TCP/IP Framework that ensures that your request finds its way through the vast network of interconnected devices.

But that is not all, we will explore the mechanisms that work behind the scenes to ensure your security on the web — picture your request traversing firewalls that filter incoming and outgoing traffic. And as we delve deeper, we’ll discover HTTPS/SSL, the cryptographic protocols that protect your sensitive information from prying eyes.

requests that leave your browser will most likely be one of the thousands of similar requests trying to access the same website. we will explore systems like load balancers that work behind the scenes to ensure that servers work in concert despite many requests to deliver content that you see and interact with. finally, we will delve into how web servers, application servers, and database management systems put together static and dynamic content that is returned to your browser a few seconds after you hit enter.

Let the Journey Begin!

let's say we want to visit Google’s search engine page to retrieve information about local pet shops nearby,

GIF showing web adress being typed

Step — 1 DNS lookup for google.com

when we open our favourite browser and enter the web address — which is a string of text that allows users to locate resources on the web, the web address gives clues to the browser on how to process your request

illustration for the parts of of website address

For instance, the HTTPS scheme tells your browser to use the HTTPS protocol to access Google's website. The browser then checks its DNS(Domain Name System) cache to find the corresponding IP address of the domain name google.com The DNS cache functions as a repository of previous DNS server queries made by your browser. If the IP address for google.com is not found in the DNS cache, the browser searches the operating system’s cache. If this also fails, the browser performs a DNS lookup through a DNS resolver server — which is a specialised computer on the internet that helps map domain names to their corresponding IP addresses, seeking the IP address specifically for google.com.

DNS acts as a phonebook. It translates human-readable domain names (google.com) to machine-readable IP addresses (142.251.46.238), which is necessary for establishing a connection. Once the IP address is found the DNS server responds to your browser with the IP address for connecting to the servers hosting the google.com page. If you're curious about how DNS servers work to retrieve the IP address check out this resource.

Why do we Need a Domain Name System(DNS)?

It is possible to access a resource on another server on the internet without its domain name, provided you can remember the 4–12+ precise digits that make up its IP address. For example, 142.251.46.238 will hopefully let you access Google's webpage. Now that is just one website. Consider for a moment all the resources on the Internet you use daily; your music streaming websites, your favourite e-commerce site, your social media platforms, your Internet banking services etc etc. Accessing these services on the internet would prove challenging if you had to keep in mind all the IP addresses even worse, lose access if for some reason the IP addresses change.

GIF showing a white male overwhelmed with mental processing of logical information
POV: me trying to remember every single IP address.

With Domain Name System(DNS) we encode IP addresses as domain names that are easier to remember so that when you enter google.com it gets resolved to its corresponding IP address.

An illustration of DNS resolution
Illustration of DNS request from the client.

Step - 2 Establishing a Secured Connection

Finally! The google.com IP address has been found, it's time to make a connection and retrieve information about local pet shops nearby.

The browser relies on a set of protocols that provides the foundation for communication on the internet referred to as the TCP/IP framework. It is a standardized four-layered framework that enables different devices and networks to connect and exchange data seamlessly. To establish a connection, the following steps are required:

  1. TCP handshake: your browser sends a request to Google’s server asking if communication can be done using TCP. If the server recognises TCP, it agrees to communicate and send the page information via the open internet to your browser.
  2. Client request to make the connection secure: after your browser and Google’s server agree to transmit data using TCP, your browser(client) sends a message to the server requesting to share information over the secured version of HTTP. HTTPS relies on encryption technology to ensure that data transferred between a client and a server is protected from prying eyes. This initial message includes information such as the supported SSL/TLS versions, encryption algorithms, and other parameters.
  3. The server responds to the request: Upon receiving the client’s message, the server responds by selecting the appropriate SSL/TLS version and encryption parameters. It sends a message back to the client, acknowledging the request and presenting its digital certificate.
  4. Browser validates the authenticity of the server: The browser validates the server’s digital certificate to ensure its authenticity. It checks the certificate against trusted certificate authorities, verifies the server’s identity, and confirms that the certificate is valid.
  5. Session Key Exchange: Once the server’s certificate is validated, the browser generates a session key which is a temporal key for encrypting and decrypting data between the browser and the server. The browser then encrypts the session key using the server’s public key obtained from the certificate and sends it to the server. Steps 2 to 5 are what constitutes an SSL/TLS handshake.

After all these steps complete successfully, a secure and reliable connection will be established, allowing encrypted communication between the browser and the server.

Step - 3 Sending your request to the Host Server

Spoiler alert! all along we’ve been interacting with a load balancer whose sole purpose is to manage traffic in the form of thousands of similar requests per second that get directed to a host server. load balancers ensure host servers are protected from getting overwhelmed and grounding to a halt. A load balancer is software that can be configured either on the same host server hosting web content or on a specialised server all on its own. Furthermore, load balancers can be configured to use load-balancing algorithms like round-robin and least connections.

looking back, you would be right to think that the DNS resolution of google.com returned the IP address of the active load balancer and the subsequent steps to establish a secured connection via TCP and TLS happened between the browser and the active load balancer. The load balancer will check all hosts and direct your request to the optimal web server that will respond to your request for web content.

an illustration of load balancers

Step - 4 Traversing Firewalls 🔥

We’re almost there! to keep web servers and web stack components secured from unauthorised access and cyber-attacks, your request will need to go through a firewall — a network security device or software that monitors and controls the incoming and outgoing network traffic based on predetermined security rules.

unlike SSL/TLS which operates at the application layer to secure communication between your browser and servers over the network, Firewalls operate at the network layer filtering traffic based on predefined rules before it reaches the application layer.

An animated GIF showing a black relieved woman.
POV: The HTTP GET Request After making it through the firewall 🔥

Step — 5 Host Server Receives our Request

After all the work done to resolve the domain name, establish TCP communication, encrypt the communication with TLS, distribute the request using a load balancer, and filter the request through a firewall the host server finally receives the request.

A look inside the Host server.

Ever found yourself pondering how web host servers work their magic? It’s quite fascinating how, upon receiving a client request, they swiftly piece together the requested information and form a response that the browser can understand. The behind-the-scenes dance of web servers is a true marvel worth exploring!

well, it turns out that webservers are typically made out of four major components popularly referred to as the LAMP Stack. The acronym has nothing to do with actual lamps. But it does refer to the dream team of four software technologies that work together to serve web content to clients

an image showing the visual representation of a lamp stack architecture
  • Linux is an operating system that the host server runs on.
  • Apache HTTP Server is a web server software used to serve static web pages. This engine will serve content like the HTML file that the browser will need to build the Google search page.
  • MySQL is a relational database management system used for creating and managing web databases.
  • PHP, Perl, and Python are programming languages used to create web applications.

All these work together to create a dynamic web browsing experience.

This is where we are currently

an illustration of web server host responding to a client request
Illustration of LAMP Stack web host servers

The Web Host Server 2(see server cluster in the image) puts together the information needed to build the Google search page with the help of the LAMP stack. including static files, scripts, and dynamic content.

This information is then SSL encrypted and sent back to the browser in the form of a response message, to be rendered.

an image showing the parts of an http response message
an example of a simple HTTP response message

Step — 6 Rendering the Google Search Page

When the browser receives the HTTP response from the host server the browser uses its HTML and CSS engine to parse the code that was included in the body section of the server’s HTTP response message. The browser then uses its Document Object Model to create a data representation of the objects that make up the structure and content on the web. All these come together in a form of a page in the browser.

image showing google page
rendered google page

we now have the page to begin the search for local pet stores nearby. When we type in our search keyword and hit enter, the browser makes a second request to the host server, this time no need for DNS resolution.

Conclusion

Our journey to unveil the hidden processes that power our internet experience has come to a close. We ventured into the world of DNS Resolution, where domain names are transformed into IP addresses. Then, we unravelled the magic of Firewalls and SSL/TLS, creating secure and encrypted connections between our browsers and host servers. Delving further, we encountered load balancers, diligently distributing our requests to responsive host servers. Peeking inside the host servers, we glimpsed the LAMP stack, a powerful setup for handling our requests. And lastly, we explored how browsers assemble webpages using the HTTP response message from the host server. With newfound knowledge, we now appreciate the intricate dance that seamlessly delivers the pages we seek.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Gabriel Simon Tagbor
Gabriel Simon Tagbor

Written by Gabriel Simon Tagbor

MLOps engineer passionate about designing and deploying scalable ML systems. Sharing insights on software architecture, data pipelines, and model deployment. 🚀

No responses yet

Write a response