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

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

— — A Technical Overview.

Have you ever been curious about what happens behind the scenes when you enter a URL in your browser and navigate to your favorite websites? How does the news reach you when you press enter after typing in the URL? How were the images on this post displayed in your browser? And how does your Twitter feed, along with the tweet data, securely appear in your browser?

Typically, the browser returns a webpage in a matter of seconds which may seem like a simple process, but the reality is that a lot of complex infrastructure is involved in loading a website.

In this post, we’ll take a comprehensive look at the technical process of loading a website, from the initial DNS request to the final web page display. The end-to-end process involves your browser, your computer’s operating system, your internet service provider, the server hosting the site, and the services operating on that server.

Jargon Buster

Unraveling some Technical Terms:

  • URL (Uniform Resource Locator) is a web address that specifies the location of a resource on the internet, such as a webpage or a file.

  • Domain name is a human-friendly label used to identify a particular website.

  • Server is a computer system or software program that provides services or resources to other computers or programs over a network.

DNS Request: The Starting Point

Credit: cloud-fare

When you enter google.com on your browser’s address bar and press enter, you initialize a sequence of events called DNS (Domain Name System) resolution. This process involves translating the human-readable domain name, such as “google.com,” into a computer-friendly IP address (such as 192.168.1.1) which informs your browser which server to communicate with.

Each device on the Internet — servers, cell phones, your smart refrigerator — all have a unique address called IP address, necessary to find the appropriate Internet device — like a street address is used to find a particular home.

DNS is like the Contacts app on our phones. DNS helps our browser (and us) find servers' IP addresses on the Internet based on the domain name, google.com.

Steps and DNS servers involved in loading a webpage

Note: DNS lookup information is often cached either locally inside the querying computer or remotely in the DNS infrastructure, which can skip steps in the DNS lookup process and make it quicker. However, when nothing is cached, there are typically 9 steps in a DNS lookup. The example below outlines all 9 steps.

  1. A user types ‘google.com’ into a web browser and the query travels into the Internet and is received by a DNS recursive resolver. The resolver is usually our Internet Service Provider.

  2. The resolver then queries a DNS root nameserver, if it doesn’t find the IP in its cache.

  3. The root server then responds to the resolver with the address of a TLD (Top-Level Domain) server which stores the information for its domains. In our case, the top-level domain is .com TLD. Other types of TLD are .net, .fr, etc

  4. The resolver then makes a request to the .com TLD.

  5. The TLD server then responds with the IP address of the domain’s authoritative name server, “google.com”. Usually, there is more than one name server attached to one domain name

  6. Lastly, the recursive resolver sends a query to the domain’s authoritative name server.

  7. The IP address for “google.com” is then returned to the resolver from the authoritative name server.

  8. The DNS resolver then responds to the web browser with the IP address of the domain requested initially.

  9. An HTTP request is then made by the browser to the IP address, and in response, the server at that IP address returns the webpage to be rendered in the browser.

Additional requests may be necessary to locate the correct IP address if the DNS record is not found at any of the name servers, or if the record has been configured to use a service like DNS load balancing or content delivery networks (CDN).

Once the IP address has been successfully resolved, it is cached by the local DNS resolver and the browser to improve the speed of future requests to the same domain name.

The length of time that the DNS record is cached, known as the “Time To Live” (TTL), is determined by the authoritative nameserver and can be adjusted by the domain owner to balance the need for fast response times.

TCP/IP: The Protocols that Power the Internet

A diagram of how the TCP/IP model divides data into packets and sends it through 4 different layers. Credit: AVG

Once the browser gets the DNS record with the IP address, it’s time for it to find the server on the Internet and establish a connection.

TCP/IP (Transmission Control Protocol/Internet Protocol) is the most common protocol used for many types of HTTP requests. It’s a set of rules governing the format of data sent via the internet or local network, such as sending e-mails, streaming videos, or connecting to a website.

To ensure that each communication reaches its intended destination intact, the TCP/IP model breaks down data into packets and then reassembles the packets into the complete message on the other end. Sending the data in small packets makes it easier to maintain accuracy versus sending all the data at once.

Common protocols include HTTP, FTP, and SMTP, and all three are often used in conjunction with the TCP/IP model.

NOTE: IP is responsible for locating the proper path for delivering packets. TCP is responsible for end-to-end delivery and the correction of errors on that path

Traffic and Security Control

After establishing the TCP connection, it’s time to start transferring data! But not so fast, first, we need some traffic control — meet the load balancer…

A Load Balancer involves distributing incoming traffic evenly across multiple servers so that no single server is overloaded. This helps to improve website performance and prevent server crashes.

For websites that receive high traffic like “google.com”, load balancing is crucial to ensure high performance and reliability. When a request arrives from a user, the load balancer assigns the request to a given server, and this process repeats for each request. Load balancers determine which server should handle each request based on a number of different algorithms. But hold on, can anyone get in? It’s time to ask the firewall….

The firewall is a system that provides network security by filtering incoming and outgoing network traffic based on a set of user-defined rules to protect against unauthorized access, such as hackers and malware.

When you type a URL like “google.com” into your browser, the request that your browser makes to Google’s server passes through a firewall which checks the incoming request to make sure it is allowed based on a custom set of security rules, such as restrictions on the IP address of the request, the number and frequency of the requests made, or the type of content being requested. The browser itself can also be equipped with a firewall to detect if the IP given by the DNS request is a potential malicious agent.

HTTPS/SSL: The Importance of Secure Connections

Now that the browser has the IP address, it is going to take care of the other part of the URL, the “https://” part.

Not secure

HTTPS stands for HyperText Transfer Protocol Secure and is a secure version of the regular HTTP. HTTPS encrypts data sent between a web server and a user’s browser, making it more difficult for attackers to intercept and steal sensitive data such as login credentials and payment information.

SSL (Secure Sockets Layer (also known as TSL, Transport Layer Security)) are encryption protocols that are used to secure the data transmitted over HTTPS. This protocol secures communications by using what’s known as an asymmetric public key infrastructure. This type of security system uses two different keys to encrypt communications between two parties:

  • The private key, controlled by the website owner, is kept on a web server and is used to decrypt information that was encrypted by the public key.

  • The public key is used for secure interaction with the server and can be accessed by anyone. Data encrypted by the public key can only be decrypted by the private key.

When a website has this certificate, we’re able to see a little lock icon next to the website name in the search bar. HTTPS and SSL work together to provide a secure communication channel for exchanging data between a client and a server.

When you type “google.com” into your browser and press enter, If the website is using HTTPS/SSL, the browser initiates a secure connection with the server by exchanging a series of messages during the SSL/TLS handshake process. This includes verifying the server’s SSL/TLS certificate, generating an asymmetric encryption key, and encrypting subsequent data transmitted between the browser and server. Once the handshake is complete, the browser sends an HTTPS request to the server to retrieve the web page content, and the server responds with an HTTPS response containing the necessary resources to render the web page in the browser.

Without HTTPS and SSL, websites would be much more vulnerable to attacks.

Web and Application Servers: Serving Up Web Pages

Once the connection is established and the user’s request is received, the web server is responsible for serving up the requested web page.

A web server is software and hardware that uses HTTP/S and other protocols to respond to clients’ requests and serves static content, like HTML, images or plain text files, CSS, and JavaScript files (also called static files) that are used to render the web page to the browser. Some of the most commonly used web servers today include Apache and Nginx.

Having a web server is the basis of any web page. But most sites don’t just want a static page where no interaction is happening, and most websites are dynamic. That means that it’s possible to interact with the site, save information on it, log in with a username and a password, etc.

An application server is a software program responsible for operating applications, communicating with database servers, managing user information, and more. It works with web servers and is able to serve a dynamic application using the static content from the web server. Some of the most commonly used application servers today include Tomcat and JBoss.

Database: Storing and Retrieving Data

The last step in our web infrastructure is the Data Base Management System (DBMS). A database is a collection of data, and the DBMS is the program that interacts with a database, allowing users to retrieve, add, and modify data stored within it.

There are several types of database models. The two main ones are relational databases and non-relational databases.PostgreSQL, MySQL, SQLite, and MariaDB are some of the most popular relational databases.

Image illustrating how the web server, application server and database work together. Source:moreequalanimals.com/posts/blockchain-is-be..

Summary

Web infrastructure refers to the collection of hardware, software, and protocols that make it possible to access and display websites on the internet.

  • When you browse a URL, your computer sends a DNS request to a DNS server to resolve the IP address associated with the domain name.

  • Once the IP address is obtained, your computer can establish a connection with the website server. The transmission of data between your computer and the website server is governed by the TCP/IP protocols.

  • The website server uses a web server software to serve up the requested web page, and if necessary, an application server to run server-side code.

  • The website may also employ security measures such as a Load balancer, firewall and HTTPS/SSL encryption to control traffic, protect against unauthorized access and ensure secure data transmission.

  • Finally, most web applications rely on a database to store and retrieve data. Overall, the web infrastructure is a complex and intricate system that allows for the seamless delivery of web content to users around the world

There is much to say, but the time limit us. Let me conclude my article by showing you a diagram of what we talked about

Diagram created to summarise entire process of what happens when you type a URL in the browser and press enter.

Conclusion

As part of the ALX Africa Software Engineering program, this post is a submission to my technical writing task.I hope you now have a better understanding of exactly what happens when you type “google.com” into your browser.

Knowing what happens when you type a URL into your browser can help you figure out where things go wrong, where to look for performance issues with your website, and to offer a secure experience for your users.

For any questions or remarks, please leave a comment below. Thank you for reading!

You can support me by following me on this blog, and also following me on Twitter.

References --- More Resources

Here are some additional resources i found useful.

For SSl certificate setup procedure — check out my article .

How DNS works

What happens when you type a URL into your browser? | Amazon Web Services

What is a Firewall and How Does It Work? | DigitalOcean

https://www.cloudflare.com/learning/dns/what-is-dns/