What Happens when you visit google.com
Published: 2023-04-16 17:08:37

When you type https://www.google.com in your browser and press Enter, a complex series of actions are set in motion, which involve various components working together to deliver the website to your browser. Let's take a closer look at the process.

**DNS Request**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0psmb536erz8d4vlsc3y.png)

When you enter the website address into your browser, the first thing that happens is a DNS (Domain Name System) request is sent to the local DNS server. The DNS server then resolves the domain name into an IP address. In this case, it translates www.google.com into its corresponding IP address.

**TCP/IP**
Once the DNS server provides the IP address, your browser initiates a TCP (Transmission Control Protocol) connection with the server at that IP address. TCP is responsible for establishing a reliable, ordered, and error-checked connection between your browser and the server.

**Firewall**
Before the connection can be established, it must pass through the firewall of the network you're using. A firewall is a security system that monitors and controls incoming and outgoing network traffic based on pre-determined security rules. If the connection is permitted by the firewall, it proceeds to the next step.

**HTTPS/SSL**
When the connection is established, the browser and the server negotiate the use of HTTPS (Hypertext Transfer Protocol Secure), which uses SSL (Secure Sockets Layer) or TLS (Transport Layer Security) encryption to ensure that the data being transferred between the browser and the server is secure and private. This is particularly important for websites that require the exchange of sensitive information, such as passwords or credit card details.

**Load-balancer**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxc1ckzpiwqazwrf7de0.png)

If the website you're accessing is particularly popular, it may be hosted on multiple servers to handle the incoming traffic. In this case, a load-balancer distributes the incoming requests evenly across the different servers, ensuring that no single server becomes overloaded.

**Web server**
Once the HTTPS connection is established, the web server receives the request from the browser and begins to process it. The web server is responsible for serving the website's static content, such as HTML, CSS, and JavaScript files.

**Application server**
If the website you're accessing has dynamic content, such as user-specific data or information pulled from a database, the request is forwarded from the web server to an application server. The application server processes the request and generates the dynamic content, which is then returned to the web server.

**Database**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wk5su86zvf672appgeam.png)


If the application server needs to retrieve data from a database to fulfill the request, it sends a query to the database server. The database server processes the query and returns the requested data to the application server, which then uses it to generate the dynamic content.

**Response**
Once the web server has received the complete response from the application server, it sends the response back to the browser over the HTTPS connection. The browser then renders the website and displays it to the user.

In conclusion, typing https://www.google.com into your browser and pressing Enter initiates a complex series of actions that involve various components working together seamlessly to deliver the website to your browser. Understanding how these components work together is important for web developers and IT professionals, as it can help them diagnose and troubleshoot issues that may arise during the process.