DEV Community

Patrick Odhiambo
Patrick Odhiambo

Posted on

What Happens When You Type https://www.google.com In Your Browser and Press ‘Enter’

Introduction

Ever wondered what happens when you type some text on your browser and press enter? Wonder no more, in this article, I will explain to you exactly what happens under the hood whenever you type anything in your browser and press enter. You will be surprised to learn that there is a lot that happens between the time you key in and search for an item and the moment an output is served back to you. You might even think that it only takes a single step like flipping a light switch on; well, it is more complex than that. By the end of this article, you will have learned exactly what happens when you type an address in your browser and press enter. Before delving into the meat of this article, let us first define some key terminologies you will meet in this write-up:

terminology

Terminologies

TCP/IP: TCP/IP (Transmission Control Protocol/Internet Protocol) is a set of networking protocols that enables communication and data exchange between computers on a network.

DNS: DNS (Domain Name System) translates human-readable domain names (like www.google.com) into numerical IP addresses that computers use to identify each other on the network.

Firewall: A firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules to protect against unauthorized access.

HTTP/SSL: HTTP/SSL (HyperText Transfer Protocol Secure/SSL) is a secure version of HTTP that uses SSL/TLS encryption to protect data transmitted between a web server and a browser.

Web Server: A web server is a software or hardware system that stores, processes, and delivers web pages to users over the internet.

Load Balancer: A load balancer distributes incoming network or application traffic across multiple servers to ensure reliability and performance.

Application Server: An application server hosts and runs application logic and services for client applications, providing functionality such as data processing and business logic.

Database: A database is an organized collection of structured data that can be easily accessed, managed, and updated.

URL: A URL (Uniform Resource Locator) is a web address that specifies the location of a resource on the internet and the protocol used to access it.

dive in

In explaining what happens when you type ‘https://www.google.com’ in your browser and press enter, perhaps the best approach would be to breakdown the entire process into steps. In sum, there are eight interconnected steps involved:

Step 1: Typing URL in the Browser

Image description

The first step entails the user typing the URL in the web browser. Once the user presses enter, the web browser splits the URL into two parts, in this case the URL
https://www.google.com is broken down into https, which is a secure communication protocol and www.google.com which is the domain name. In this case the HTTPS protocol will use port 443.

Step 2: DNS

DNS

In this second step, the browser using the domain name from the URL provided by the user will look up the IP address of the sever that is hosting the website being sought. As a starting point, the hostname will be checked in the cache of the browser to check if the same had been looked up before. If the hostname is found in the cache, the browser will then pull its IP address and find the server on the internet and establish connection.

If the browser does not find the hostname in the cache, it will send a DNS request to the DNS server to look up the corresponding IP address to the domain name and send this to the server hosting the website to the browser. Once this is sent to the browser, it will then find the server on the internet and establish connection.

The explanation above is a high overview of the workings of the DNS. If you would like to go deeper and understand more on how the DNS works, please read this article

Step 3: TCP/IP

TCP

After resolving the IP address of the hostname, the browser then proceeds to communicate with the server. The TCP/IP aids in establishing communication between the browser and the server. TCP is a powerful transmission protocol which ensures that packets are delivered from sender to receiver and no packet is lost in the process. In this context, the browser will communicate with the server hosting the website www.google.com over TCP and ensure that all the requests and responses are received.
The diagram below shows how TCP works

TCP/IP

Step 4: SSL

SSL

Since the protocol had been specified as HTTPS, the before connecting and communicating with the server over TCP, the browser will first have to undergo a security check. SSL will take over the security checks and provide a secure transport layer for the connection between the browser and server to be established. This is achieved through a handshake protocol which establishes a secure channel for the browser and server to communicate. Therefore, all HTTPS connections must start with an SSL handshake
This diagram presents a high-level description of how SSL works

SSL works

Step 5: HTTP/HTTPS
HTTP (HyperText Transfer Protocol) is an application protocol, with HTTPS being its secure version. Communication between a web browser and a server occurs through HTTP requests and responses. The client, using the web browser, sends an HTTP request to the server, which processes the request by running an application. The server then returns an HTTP response to the browser, which the client receives.

Here are four different HTTP requests:
GET request to get data from the server
POST request to send data to the server
PUT request to update existing data in the server
DELETE request to delete data from the server

GET

Once the SSL handshake is complete, the browser sends a GET request, which will enable it to receive an informative response from the server as shown in the image above.

Step 6: Load Balancer

Loadbalancer

A load balancer distributes traffic evenly across multiple servers to prevent any single server from becoming overloaded, thereby improving speed and performance. If a server fails, the load balancer redirects traffic to the remaining operational servers, and it automatically starts routing requests to new servers as they are added. This ensures continuous availability and optimal resource utilization.

LB

Think of a load balancer as a supervisor who receives the workload from management and distributes it to different line workers depending on their capacity and availability

Step 7: Firewall

FW

The firewall is a software that is used to filter all incoming and outgoing traffic based on some predefined rules. For instance, if the firewall on the server is configured to allow traffic from port 443 which is HTTPS, then our request will pass the firewall and get to the server.

SG

Think of the firewall as a security guard manning a gate. The guard has explicit instructions to only allow persons carrying specified IDs in and deny entry to anyone without the ID. So, everyone seeking admission must produce the ID to be allowed in.

In our case, the incoming HTTPS traffic from the load balancer will be allowed to access the server by the firewall because the firewall rules allow HTTPS traffic.

Step 8: Web Server, Application Server and Database

WS

The journey that started at Step 1 finally terminates at Step 8, yippee!!
The information requested by the user can be either dynamic or static.
Dynamic content is frequently changing, while static content remains largely unchanged.
When the web server receives the HTTP request, it retrieves the requested file.
If the file contains dynamic content, the application server processes it and generates a web page, which the web server then delivers to the user.
If this dynamic content requires data from a database, the web server queries the database and delivers the results to the user.
Static content, on the other hand, is delivered directly to the user by the web server without additional processing.

Bringing it all together

The different steps do not operate independent of each other, the diagram below shows how they all tie up together to deliver the expected results

Image description

Top comments (1)

Collapse
 
stevecmd profile image
Steve Murimi

Insightful!