What happens when I type https://www.google.com in my browser and press Enter?

·

3 min read

When I enter google.com in my browser, a series of complex procedures are automatically enacted, ending with the browser's display of Google's homepage with the iconic dynamic search box. In this blog, I'll try to breakdown those complex procedures into distinct parts, to enable you grasp the underlying logic. Needless to say, there're many benefits to having that understanding.

Step 1: DNS request

First and foremost, my browser sends a request to the DNS(Domain Name System) server. To find and resolve the IP address that corresponds to the url. The server is like a phone book that translates memorable URLs to parsable IP addresses. It sends the IP address to the browser if it have it cached, else it searches other DNS servers till it finds it.

Step 2: TCP/IP

Once my browser have the IP address from the DNS server, it opens a TCP(Transmission Control Protocol) connection to the load-balancer that redirects traffic to the web servers hosting the website. TCP ensures data are reliably transferred over the internet. The connection is made over 443 port, which is the standard port for HTTPS(HyperText Transfer Protocol Secure) traffic.

Step 3: Firewall

Before the connection opened by TCP/IP can get to the load-balancer, it has to be checked by the firewall to ensure that it is legitimate. The firewall filters both incoming and outgoing traffic, verifying that the connection is made over port 443.

Step 4: HTTPS/SSL

Once the connection is established and before any data is sent through it, an SSL (Secure Sockets Layer) handshake occurs. By this the browser and load balancer establishes a secure encrypted connection. The handshake includes a process where my browser verifies the authenticity of the load balancer and the validity of the encryption key.

Once the SSL handshake is done, my browser sends a HTTPS request to the load-balancer asking for the webpage. The request will include my browser type, and what kind of language it prefers, stored cookies among others.

Step 5: Load-balancer

The load-balancer intercepts the HTTP request and using the configured method, send the request to the appropriate web server to handle it. That's presuming that Google have more than one web server, which is a fair assumption considering its scale. This makes for an even load distribution and maximum uptime.

Step 6: Web server

The web server receives the redirected request from the load-balancer and responds by sending the webpage with the requested HTML, CSS and JavaScript.

Step 7: Application server

For dynamic contents, such as user-specific information or search results, the web server sends a request to the application server to handle it, by generating the required contents and sending it back to the web server to parse.

Step 8: Database

To access data stored in a database, the application server will send a query to the database server. The results will be collated by the application server and forwarded to the web server.

Step 9: Response

The web server sends the HTTP response from the application and database servers, back to my browser via the load-balancer, over the encrypted TCP connection. This response includes the webpage's HTML, CSS, and JavaScript files, as well as any other assets (like images or videos) needed to display the webpage correctly.

Step 10: Rendering

Finally, my browser receives this HTTP response and begins rendering the webpage. This process involves interpreting the HTML, applying the CSS styles, and executing any JavaScript code. Once the webpage is fully rendered, I can interact with it by making search queries, clicking on links, and so on.

Conclusively, when I type "google.com" in my browser and press enter, my computer initiates a series of requests and responses that involve multiple servers, protocols, and technologies working together seamlessly to deliver the Google homepage to my screen. Understanding these processes help me troubleshoot issues that often arise while browsing the web or developing web-based applications, and also gives me a greater appreciation for the incredible underlying technologies, that makes the modern internet possible.