What happens when you type google.com in your browser and press “Enter”

Table of contents

No heading

No headings in the article.

Hey there! Welcome to my first ever blog post. I hope you’re having as great a day as mine. Have you ever given some thought as to what happens when you enter a URL into a web browser? Well, join me on this journey as we take a deep dive into what goes on behind the scenes. I hope you’re as excited as me 😄

When you type "https://www.google.com" into your web browser and hit Enter, a series of events take place which cause the Google homepage to eventually appear on the screen. DNS servers, TCP/IP protocols, firewalls, HTTPS/SSL encryption, load balancers, web servers, application servers, and databases are some of the several components that are involved in this process. In this blog post, I will try to summarize of the sequence of events that occur:

DNS request

In order to resolve the domain name "google.com" into an IP address, the computer first sends a request to a Domain Name System (DNS) server. This is very important since IP addresses (rather than domain names) are used for communicating between computers. Your computer receives the IP address once the DNS server looks up the IP address for the corresponding domain name.

The computer initially looks in its local DNS cache to verify whether it already has the IP address saved before attempting to resolve the domain name. If it is not already stored in cache, the computer asks a DNS server to search up the IP address. The IP address for the requested domain name is then returned by the DNS server, which keeps a database of domain names and their corresponding IP addresses.

TCP/IP

Once the IP address has been resolved, the computer creates a connection with Google's servers using the Transmission Control Protocol (TCP) and the Internet Protocol once it knows the IP address for those servers (IP). TCP is in charge of breaking up the data you wish to communicate into packets and transferring them to the target (for example, the request to load the Google site). Those packets must be routed via IP through the network to their intended recipient.

TCP establishes a connection between the client (your computer) and the server (Google's servers) by sending the server a "handshake" message (from the client), to which the server replies with a confirmation message. Once the connection has been made, the client may send the server requests successfully (in this case, the request to load the Google homepage).

Firewall

These data packets may go via one or more firewalls on their route to Google's servers. A firewall is a type of security system that keeps track of and manages incoming and outgoing network traffic in accordance with pre-established security rules. By preventing incoming and outgoing traffic that doesn't adhere to specified security criteria, it can safeguard a network from unauthorized access.

For instance, if a certain IP address or range of addresses is known to be the source of malicious activity, a firewall may be configured to block all incoming traffic from them. Alternatively, it can be configured to block all traffic except those which the security rules expressly permit. The firewall serves as a physical barrier in both scenarios between the trusted internal networks and untrusted external networks (e.g, the internet).

HTTPS/SSL

Using Secure Sockets Layer (SSL) or Transport Layer Security, the packets are encrypted once they reach Google's servers (TLS). By doing this, it is made sure that the data being sent is safe and cannot be intercepted. The usage of SSL/TLS and the "https" prefix in the URL denote a secure connection.

Public key and symmetric key cryptography are used in tandem by SSL/TLS to function. The server transmits the client its public key whenever a client (like your web browser) establishes a secure connection to a server (like Google's servers). The data that the client wishes to send to the server is then encrypted using this key. The only party that has the private key to decrypt the data is the server. By doing this, the data is only accessible by its intended recipient and no one else.

Additionally, SSL/TLS offers authentication together with encryption. In other words, it ensures that the client is truly connecting with the server it was meant to connect to - and not with a malicious third party posing as the server - by authenticating the identity of the server to the client. Digital certificates and a system of trust known as Certificate Authority(CA), are used for this.

Load Balancer

Given that Google's servers are probably dispersed over several locations, a load balancer is responsible for spreading incoming traffic among them. By doing this, it ensures that no server is overworked and that the load is distributed as equally as possible.

In high-traffic scenarios where a single server would be unable to manage the amount of requests, load balancers are frequently used. They operate by spreading incoming requests across a number of servers, choosing the best server for each request based on a variety of algorithms (e.g round-robin and least-conn). By doing this, the servers are utilized efficiently and the load is divided evenly.

Web Server

A Google web server that handles HTTP requests is chosen by the load balancer as the recipient of the request. The web server finds and transmits back to the client (computer) the requested webpage (in this case, the Google homepage) and any related resources (e.g HTML, CSS, images etc).

The requests and responses sent over HTTP are handled by web servers specifically. They keep an eye out for requests on a specific port (often port 80 for HTTP or port 443 for HTTPS), and when one comes in, they process it and respond to the client. The response generally consists of an HTML file that the web server either dynamically generates (by executing server-side logic) or retreives from its local file system.

Application Server

Some websites may demand more work than a basic web server is capable of handling, such as those that require logging in or show dynamic information. In cases like these, the request may be sent to an application server, which would then run server-side scripts/logic (such as PHP, JavaScript, or Python) to produce the HTML that would then be rendered to the client.

Unlike web servers, application servers are built to perform more complicated operations. They are generally used to produce dynamic content and run server-side scripts/logic (using programming languages like PHP, JavaScript, or Python). For instance, data from a database may be retrieved, processed, and then included in an HTML page that is then sent back to the client via an application server.

The application server will send a request to a database server to get the required data if the webpage needs access to data that is stored in a database (for example, to retrieve search results). The application server then receives the data from the database server and merges it into the final HTML response that gets sent to the client.

Database

If a webpage needs to access data from a database, such as to get search results, the application server will send a request to a database server to retrieve the required information. The data is returned from the database server to the application server, which then includes it in the finished HTML response that is rendered on the client side.

Organizing, retrieving, and storing data are the sole responsibilities of database servers. To enable users to access and modify the data contained inside them, they make use of a number of data storage technologies (such as relational databases, NoSQL databases, etc.) and support a variety of query languages (e.g SQL.).

That's all folks! I hope you enjoyed this mildly detailed and technical explanation of what happens when you enter a URL into your web browser. Until next time, cheerios!