What happens when you type google.com in your browser and press Enter

Entering https://www.google.com into your browser and pressing enter triggers a sequence of background actions, which will be comprehensively explained in this blog post. These actions comprise:

  • DNS request

  • TCP/IP

  • Firewall

  • HTTPS/SSL

  • Load-balancer

  • Web server

  • Application server

  • Database

The first step in the process of accessing a website is resolving the domain name to an IP address to identify the web server hosting the website. This process is called a DNS request (Domain Name System).

DNS request in details

DNS is a hierarchical decentralized naming system that translates human-readable domain names like www.google.com into IP addresses that are used by computers to communicate with each other over the internet. DNS servers store a database of domain names and their corresponding IP addresses, and they provide this information to other servers or clients upon request.

When you enter a URL into your browser, the browser sends a DNS query to a DNS resolver or DNS server to obtain the IP address associated with the domain name. The resolver or server may be provided by your ISP (Internet Service Provider), a public DNS service like Google DNS or Cloudflare DNS, or an enterprise DNS server managed by your organization.

The DNS query process involves several steps:

  1. Local DNS cache lookup: The first step in the process is to check if the DNS resolver has a cached record of the requested domain name. If the record is found in the cache, the resolver returns the IP address to the browser, and the request is complete.

  2. Recursive DNS query: If the record is not found in the cache, the resolver initiates a recursive DNS query. In this process, the resolver sends a query to the root DNS server, asking for the IP address associated with the top-level domain (TLD) of the requested domain name (.com, .org, .net, etc.).

  3. TLD DNS server lookup: The root DNS server returns the IP address of the TLD DNS server responsible for the requested domain name (e.g., the .com DNS server for www.google.com).

  4. Authoritative DNS server lookup: The resolver sends a query to the TLD DNS server, asking for the IP address of the authoritative DNS server for the requested domain name.

  5. IP address resolution: Finally, the resolver sends a query to the authoritative DNS server, asking for the IP address associated with the requested domain name. The authoritative DNS server responds with the IP address, and the resolver caches the record for future use.

The DNS request process is an essential step in accessing websites on the internet, as it translates human-readable domain names into machine-readable IP addresses. Without DNS, users would have to remember and enter the IP addresses of websites to access them, which would be impractical and error-prone.

TCP/IP in details

When you enter a website address in your browser, the browser first uses the Domain Name System (DNS) to obtain the IP address of the server hosting the website. Once the browser has the IP address, it initiates a TCP/IP connection with the server.

TCP/IP is a set of rules (protocol) that helps computers communicate with each other over the internet. Let me try to explain it in simple terms, Imagine you're playing a game with your friend, but you're in different rooms and you can't talk to each other. You want to tell your friend what you're doing in the game, but you don't know how. That's where TCP/IP comes in!

TCP/IP has two main parts: TCP and IP.

TCP stands for Transmission Control Protocol. It's like a messenger that makes sure your message gets to your friend without getting lost or mixed up along the way. When you send a message, TCP breaks it up into little packets (kind of like puzzle pieces) and puts a number on each one. Then it sends them off to your friend's computer.

IP stands for Internet Protocol. It's like an address book for the Internet. Every computer on the internet has its unique IP address, kind of like a phone number. When you send a message, IP puts your friend's IP address on it, so it knows where to go.

So, TCP breaks up your message into little packets and puts a number on each one, and IP puts your friend's IP address on it. Then, the packets travel across the internet, going through different computers along the way (kind of like a relay race). Each computer checks the number on the packet and sends it on to the next computer until it finally gets to your friend's computer.

When all the packets arrive at your friend's computer, TCP puts them back together in the right order, like putting together a puzzle. Then, your friend's computer can read your message and send a message back to you using TCP/IP.

That's TCP/IP in a nutshell! It's like a messenger and an address book that help computers talk to each other over the internet.

Firewall

A firewall is a security measure that manages and observes the traffic coming in and going out of a network. It serves as a barrier between a private network and the public internet, protecting it against unauthorized access, malware, and other security risks.

When you enter a URL such as "www.google.com" in your browser, the browser initiates a request to the web server that is hosting the website, usually via the HTTP or HTTPS protocol. This request traverses multiple networks, including your local network and your Internet Service Provider's network, and may encounter multiple firewalls along the way. This firewall examines the incoming request to verify whether it is permissible, based on its security protocols and rules.

Types of security rules that a firewall uses to check incoming requests

  • Port-based rules: These rules inspect the specific port number used in the incoming request to determine whether it matches the allowed or restricted ports list.

  • IP-based rules: These rules verify the source IP address of the incoming request against a list of allowed or blocked IP addresses.

  • Protocol-based rules: These rules analyze the protocol used in the incoming request, such as HTTP, HTTPS, FTP, or SMTP, to determine whether it matches the allowed or restricted protocols list.

While the rules mentioned above are some of the most commonly used security rules, there are several other types of rules that firewalls may employ to check incoming requests.

HTTPS/SSL

HTTPS (Hypertext Transfer Protocol Secure) is a way of making sure that the data you send between your web browser and the website you're visiting is secure and private. It adds a layer of encryption to your internet connection, so that any sensitive data, such as login credentials or personal information, cannot be intercepted by hackers.

This encryption is made possible by SSL (Secure Sockets Layer) or TLS (Transport Layer Security), which are security protocols that use a combination of public and private keys to encrypt and decrypt data exchanged between the server and the client.

When you visit a website using HTTPS, your browser first requests a digital certificate from the web server, which contains the server's public key. The browser then verifies the certificate's authenticity and uses the public key to encrypt a randomly generated symmetric key. The symmetric key is then sent back to the server, which uses its private key to decrypt the symmetric key. Once the symmetric key has been exchanged, all data exchanged between the server and the client is encrypted using this symmetric key.

In simple terms, HTTPS and SSL/TLS provide a secure and private way of sending data over the internet, protecting your sensitive information from being intercepted and misused.

Load balancer

A load balancer is a hardware or software device that distributes incoming network traffic across multiple servers to avoid overload on any individual server.

In the scenario where a website is hosted on multiple servers, a load balancer serves as a middleman between the user's web browser and the available servers. It directs incoming traffic to the appropriate server after considering several factors, such as server health, capacity, load, and user session continuity.

Once the load balancer has selected a server to handle the request, it forwards the request to that server and waits for a response. The response from the server is then sent back to the client through the load balancer.

A significant advantage of utilizing a load balancer is its capacity to evenly distribute traffic among multiple servers, avoiding the possibility of a single server being overloaded or excessively burdened with traffic. Additionally, load balancing enhances website performance and availability, allowing for effortless failover and redundancy in case of server failures or maintenance.

Web server

A web server is an application that responds to clients' incoming HTTP requests, like web browsers and serves web content over the internet. Whenever a user enters a URL or clicks on a link, the browser sends an HTTP request to the web server to retrieve the requested resource, which can be anything from an HTML document to an image file.

The web server receives the request and handles it based on its configuration and the content of the requested resource. It locates and retrieves the requested file from its storage location and then generates an HTTP response that includes the requested content, HTTP status code, and response headers appropriate for the request.

Application server

An application server is a software program that handles the processing of dynamic content on a website or web-based application. Unlike a web server, which primarily serves static content, an application server is designed to generate dynamic content on the fly in response to user requests.

When a user interacts with a website that relies on an application server, their requests are sent to the application server, which generates the necessary response based on the user's input and the logic of the application.

For example, consider an online shopping website that allows users to browse products and make purchases. When a user searches for a specific item, their request is sent to the application server, which queries the website's product database and returns the relevant results to the user's browser.

Without an application server, the website would not be able to dynamically generate search results or handle user account information. Instead, it would only be able to serve static content, such as HTML pages and images.

Database

A database is a software system that stores and manages data. It is used to store data in an organized and structured way, making it easy to retrieve and modify the data as needed. In the context of a website that requires data storage, a database is typically used to store large amounts of data, such as user accounts, product information, and customer orders.

When a user submits a request to a website, the application server may need to query the database to retrieve the required data. For example, when a user logs in to an e-commerce website, the application server will query the database to verify the user's credentials and retrieve their account information.

There are different types of databases, including relational databases, NoSQL databases, and graph databases. Each type has its own strengths and weaknesses, and the choice of the database depends on the specific requirements of the website.

Rendering page

Your web browser then receives the response from the server and begins rendering the HTML code to display the webpage on your screen. It processes the HTML code and applies any associated stylesheets and scripts to create the final layout of the page. This includes displaying images, text, and other multimedia elements as specified by the HTML code.

Once the rendering process is complete, you can interact with the Google homepage by clicking on links, typing in search queries, and using other features provided by the webpage.

Conclusion

I submitted this article as my response to a technical writing assignment for the ALX Africa Software Engineering course. I hope you found it educational and now have a better understanding of the steps taken when you type in a URL like "google.com" and hit Enter in your browser.

If you wish to reach out to me directly, feel free to send me a DM on Twitter, and I would be delighted to connect with you on a personal level.

You can also support me by following me on this blog.

10
Subscribe to my newsletter

Read articles from Lawal Damilare Toheeb directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Lawal Damilare Toheeb
Lawal Damilare Toheeb