What happens when you type https://www.google.com and press enter?
web infrastructure design

What happens when you type https://www.google.com and press enter?

Whenever you open your browser to navigate to your favourite site, be it a social media site, a music hosting site or an ecommerce site, the first step you take is to enter the website’s URL into a search box and then press enter. Have you ever wondered how the browser finds the website in this big web called the internet? How does the music from Audiomack pop up on your screen after a few seconds (or minutes, usually depending on the speed of one’s internet connection)?


The aim of this post is to explore what happens behind the scenes when you type Google’s URL into a search box and press Enter. We’ll take a close look at what happens from when the browser sends the request for the site to when the site’s data is displayed on the user’s screen. This blog covers the following key points:

  • DNS request
  • TCP/IP
  • Firewall
  • HTTPS/SSL
  • Load-balancer
  • Web server
  • Application server
  • Database

 

Brief overview

A website is a collection of files that determines how the site and its data are displayed. These files are usually HTML, CSS, Javascript and images, sometimes audio and video. It has to be accessible to any user from anywhere around the world at any point in time. For this reason, special dedicated high power computers called servers are used to store these files.

To be able to locate which server your website’s data resides on, the browser uses the domain name, in our case, the google.com, to find the address of the server.

In reality, a website’s true identity, also known as the IP address, is what is known by other devices on the internet. There are two types of IP addresses that exist at the moment; IPv4 and IPv6. The IPv4 address and IPv6 address for google.com are 8.8.8.8 and 2001:4860:4860::8888 respectively.

The problem with these addresses is that it is difficult for any human to keep these in their minds. Domain names such as google.com were created to ease the burden of having to store these IP addresses in our minds. DNS helps us to find servers on the Internet, similar to how we find contact numbers from our phone books.

In the following texts, I will delve deep into the processes that are involved when the DNS request is sent to when the website is displayed on the screen.

 

How it works

  1. The URL (https://www.google.com) is entered.

The URL consists mainly of a scheme, (https://) and a domain name (google.com).

  • The scheme: HTTPS represents HyperText Transfer Protocol Secure. This instructs the browser to connect to the server using Transport Layer Security (TLS). TLS is an encryption protocol that secures communications over the internet. When a connection is made via HTTPS, all data transfer that occurs over that connection is encrypted.
  • The domain name: google.com is the domain name of the target site. This is the name by which human beings recognize Google’s primary server and it points to the server’s IP address. This is the name used by a DNS to identify the server which a browser requests for.


2. DNS lookup

Once the URL is typed into the browser and enter is pressed, the browser starts to find out which server it needs to connect to. DNS (Domain Name System) lookup is the process of finding the IP address associated with a domain name. When you enter a URL (Uniform Resource Locator) into your web browser's address bar, your computer sends a request to a DNS server to resolve the domain name into an IP address. This is necessary because computers and other devices on the Internet communicate with each other using IP addresses, not domain names.

The DNS lookup process involves several steps:

  1. Your computer sends a request to your local DNS resolver, asking it to resolve the domain name.
  2. If the local DNS resolver has the IP address in its cache (a record of recent DNS lookups), it returns the IP address to your computer.
  3. If the local DNS resolver does not have the IP address in its cache, it sends a request to a root nameserver to find the IP address.
  4. The root name server responds with the IP address of a top-level domain (TLD) nameserver, such as .com or .org.
  5. The local DNS resolver sends a request to the TLD nameserver to find the IP address.
  6. The TLD name server responds with the IP address of the authoritative nameserver for the domain.
  7. The local DNS resolver sends a request to the authoritative nameserver to find the IP address.
  8. The authoritative nameserver responds with the IP address for the domain.
  9. The local DNS resolver sends the IP address back to your computer, and your computer uses the IP address to connect to the web server and request the website.

The DNS lookup process typically takes only a few milliseconds to complete, but it is an essential step in the process of accessing a website.

 

3. Browser establishes a TCP connection with the server.

A TCP connection is established through a process called three-way handshake. The process is as follows:

  1. The client sends a packet with the SYN flag set to the server, requesting to establish a connection.
  2. The server receives the SYN packet and responds with a packet with the SYN and ACK flags set. This is called a SYN-ACK packet. The SYN-ACK packet acknowledges receipt of the SYN packet and also tells the client that the server is ready to receive data.
  3. The client receives the SYN-ACK packet and responds with a packet with the ACK flag set. This is called an ACK packet. The ACK packet acknowledges receipt of the SYN-ACK packet and completes the three-way handshake.

At this point, the TCP connection is established and the client and server can begin sending data to each other.


4. Browser sends the HTTP request to the server.

When a user enters Google’s URL (https://www.google.com) into their web browser, the browser sends an HTTP request to the server where the website is hosted. The server then responds by sending the requested web page back to the browser, which displays it to the user. The HTTP request includes various pieces of information, such as the type of request being made (e.g., GET, POST, HEAD), the path to the specific resource being requested, and any parameters or data being sent to the server. The server processes the request and sends back a response, which includes the status of the request (e.g., success or error), as well as any data or content being sent back to the browser.

 

5. Server processes request and sends back a response

  1. A client, such as a web browser, sends a request to a server using a specific protocol, such as HTTP or HTTPS.
  2. The server receives the request and processes it. This may involve retrieving data from a database, rendering a web page, or performing some other task.
  3. Once the server has completed processing the request, it sends a response back to the client. The response includes a status code, which indicates the success or failure of the request, and any data that the client has requested.

For example, when you visit a website, your web browser sends a request to the server where the website is hosted. The server processes the request and returns the HTML, CSS, and JavaScript files that make up the website, along with any data that the website needs to display. Your web browser then uses these files to render the website for you to interact with.


6.  Rendering the content in the browser

After a web server sends a response to a client's request, the client (usually a web browser) is responsible for rendering the content of the response.

Rendering refers to the process of taking raw data and turning it into a visual representation that can be displayed on a screen. In the context of web development, this typically involves converting HTML, CSS, and JavaScript code into a visual webpage that a user can interact with.

When a web browser receives a response from a server, it begins the rendering process by parsing the HTML, CSS, and JavaScript code contained in the response. The browser then uses this code to construct a Document Object Model (DOM) of the webpage, which represents the structure of the webpage in a way that the browser can understand.

Once the DOM has been created, the browser uses the CSS code to apply styles to the elements of the webpage and lay them out on the screen. Finally, the browser executes the JavaScript code, which can interact with the DOM and add dynamic functionality to the webpage.

When all of these steps are completed, the browser displays the fully-rendered webpage to the user.

 

Summary

In summary, typing "https://www.google.com" into your web browser and pressing enter initiates a series of events that involves your computer sending requests to DNS and web servers, and receiving responses in the form of HTML code and other resources, which are then rendered on your screen. This process is secure thanks to the use of HTTPS and SSL/TLS encryption.

To view or add a comment, sign in

More articles by Edward Jr A.

  • One Step At A Time

    Learning programming languages and building hardware-software integrated systems can feel overwhelming at first, but…

    2 Comments
  • Postmortem

    Apache Server returning a 500 error The following is the incident report for the WordPress 500 internal server error…

Others also viewed

Explore content categories