What Happens When You Type https://www.google.com in Your Browser and Press Enter?

Introduction:

Have you ever wondered what happens behind the scenes when you type a URL in your browser and press enter? In this blog post, we will explore the web stack and understand how various components work together to deliver the website to your browser.

DNS Request:

When you type https://www.google.com in your browser, the first thing that happens is a Domain Name System (DNS) request. DNS is like a phone book that translates human-readable domain names into machine-readable IP addresses. Your computer sends a DNS request to a DNS server to resolve the IP address of the server hosting the website.

TCP/IP:

Once the DNS server resolves the IP address of the server, your computer establishes a Transmission Control Protocol (TCP) connection with the server using the Internet Protocol (IP). TCP/IP is a set of protocols that govern how data is transmitted over the internet. The TCP protocol ensures that data packets are transmitted in the correct order and retransmits lost packets.

Firewall:

Before the TCP connection is established, the firewall on your computer checks if the website's IP address is on the list of trusted websites. If it is not, the firewall blocks the connection.

HTTPS/SSL:

After the TCP connection is established, your browser initiates a handshake with the server to establish a secure connection using the Hypertext Transfer Protocol Secure (HTTPS) protocol. HTTPS encrypts the data transmitted between your browser and the server to prevent eavesdropping and tampering. The Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols are used to establish the secure connection.

Load-balancer:

If the website is hosted on multiple servers, a load balancer distributes incoming requests across the servers to balance the load. The load balancer checks the health of each server and sends the request to the server with the least load.

Web Server:

Once the request reaches the server, the web server processes the request and sends the response back to your browser. The web server may perform various tasks such as fetching data from a database, executing server-side scripts, or generating dynamic content.

Application Server:

If the website has complex business logic or requires server-side processing, an application server may be used. The application server runs the server-side code and communicates with the web server to generate the response.

Database:

If the website requires data storage, a database server is used. The database server stores and retrieves data requested by the application server.

Conclusion:

In this blog post, we explored the web stack and understood how various components work together to deliver a website to your browser. From the DNS request to the database server, each component plays a crucial role in delivering a fast and secure browsing experience. By understanding how the web stack works, we can build better websites and troubleshoot issues when things go wrong.