What happens when you type âgoogle.comâ into your browser? Less than 20% of the world can answer this question. You are about to become part of this elite group. In simple terms, when you type in google.com and press enter, you are sending a request for Googleâs homepage. Google receives this request and responds with the homepage, Tada!. Thatâs it guys, thank you for coming.
The Journey Begins: DNS Lookup
If youâre still reading, Iâll assume you want to know more. We will get a little more technical (Not too much, hopefully). When you type âgoogle.comâ into your browser, it needs to know Googleâs address.
Address? Yes, websites live at specific addresses.
You can think of the internet as a network of roads that link computers together. If you wanted to go to the mall, you would get on the road and navigate towards the mall. Likewise, must navigate its way across the internet from source to destination. It needs to know where itâs going. Computer addresses look like this 195.94.234.134. That is called an IP address. While IP addresses are great for identification, itâs difficult for humans to remember (Imagine having to type something like that to watch NetflixâŚugh). To solve this problem, we use the Domain Name Server which maps IP addresses to text-based names like google.com just like a phonebook matching names with numbers. That way, we focus on remembering the domain name and let the DNS figure out the IP address.
Establishing Communication: The TCP Handshake
Now letâs do this again. When you enter google.com into your browser, your browser sends asks the Domain Name Server for Googleâs IP address. Once your browser knows Googleâs IP, it initiates a conversation with a Google server using the TCP (Transmission Control Protocol). Letâs simplify this using our everyday human protocols. For example, in certain cultures, people greet each other by bowing while in some cultures, a handshake is the norm. Computers also communicate using certain protocols. Your browser first sends a message to the server, and the server sends back an acknowledgment to your browser. Then your browser sends a message again to establish a TCP connection. This is called the three-way handshake (Computers exchange pleasantries too). After establishing the connection, our browser sends the request to the Google server, and the server responds with the homepage.
Servers and Web Servers: What's the Difference?
But wait, what is a server? It is a computer (physical or virtual) dedicated to providing functionality to other computers. Servers perform tasks, house applications, and websites. Servers differ from web servers. Web servers are software applications that live on servers. A web server connects a server to the internet. It handles web requests, serves static content, or communicates with other applications to serve dynamic content (we wonât go into that in here).
Handling the Traffic: Load Balancers
Letâs tie all these together. We enter google.com into your browser, you query the DNS for Googleâs IP address. Using Googleâs IP address, our browser sends a request to a Google server and the two computers (our computer and Googleâs server) establish a TCP connection. The request is received by a web server on a Google server. The web server then returns Googleâs homepage as an HTML file for our browser to open. You might have noticed I kept mentioning âa Google serverâ Thatâs because a company as large as Google has thousands of servers. How does our browser know which server to send the request to? It doesnât, thatâs the job of the conveniently named load balancer. If you have ever had to call customer service to complain, you might have probably been told that you were being routed to an available service agent. There could be a thousand service agents, but you only need one free agent to address your issue. This is the job of the load balancer, it routes incoming requests to available servers.
Security Matters: HTTPS and Firewalls
Great, if youâve read this far, you are part of the elite 20% who understand how web requests are handled. The request your browser sends to Googleâs server is called an HTTP request (Hypertext Transfer Protocol). HTTP is the set of procedures that transfer information from one computer to another. It is like sending a letter with data and instructions from one computer to another. However, HTTP is open, and anyone who intercepts it can read that letter. To solve this problem, the introduction of HTTPS (Hypertext Transfer Protocol Secure) encrypts the data, allowing only the sender and receiver to access it, similar to putting a letter in an envelope and sealing it. It is achieved using SSL certificates (Secure Socket Layer). The Server keeps a private key and shares the public keys with the browser. SSL certificates help to establish a secure connection to encrypt data. Another security feature is the use of a firewall. A firewall acts like a filter to determine what sort of requests or connections are allowed to and from a computer. For example, preventing malicious actors from accessing the server.
Conclusion
Finally (I promise!), when you type google.com into your browser, your browser queries the DNS for Googleâs IP address. After receiving the IP address, it sends an HTTPS request that is received by a Google server that hosts a firewall and a load balancer. The firewall filters the traffic and the load balancer sends your request to an available server. Your request reaches the available server via the web server that it hosts. The web server then sends an acknowledgment with a secret key to your browser to establish a secure TCP connection via HTTPS. Your browser then sends the request with this secret key, ensuring the request is encrypted. The web server receives the decrypts the request for the homepage and sends an HTTP response containing an HTML of Googleâs to your browser. Your browser opens this HTML file and reveals Googleâs home page!. There you have it, that is what happens when you enter google.com into your browser