Sitemap

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

5 min readNov 13, 2022

In this post, we will looking into the process that occurs when you type in https://www.google.com in your browser and press the Enter key. The process involves the browser, your computer’s operating system, your internet service provider, the server where the site is hosted, and services running on that server.

Websites are collections of files, often HTML, CSS, Javascript, and images, that tell your browser how to display the site, images, and data. They need to be accessible to anyone from anywhere at anytime, therefore, a powerful external computer connected to the Internet, called a server, stores these files. When you point your browser at a URL like https://www.google.com, your browser has to figure out which server on the Internet is hosting the site. Each device on the Internet — servers, cell phones, your smart refrigerator — all have a unique address called an IP address. Computers and other devices communicate using IP addresses to identify each other on the internet. But humans can’t remember IP addresses, so they use words. The browser looks for the IP address of the url in the domain name system (DNS). The domain name system (DNS) brings the two together and gets you to your destination.

When the browser receives the IP address, it will build a connection between the browser and the server using the internet protocol. The most common protocol used is TCP/IP protocol. The connection is established using a three-way handshake. It is a three-step process.

  1. The client sends a SYN(synchronize) message to the server which informs the server that the client wants to start a communication.
  2. If the server has open ports and is ready to accept connections, it acknowledges the SYN packet sent by the client with the SYN-ACK (synchronize-acknowledge) packet.
  3. The client then acknowledges the response of the server by sending an ACK packet.

Hence, a reliable connection is established for data transmission.

The next step is to connect through HTTP. TCP is the internet protocol used to connect two computers over the internet while HTTP is a web protocol used to exchange web data. The browser sends a GET request to the server asking for https://www.google.com webpage. It will also send the cookies that the browser has for this domain. Cookies are designed for websites to remember stateful information (items in a shopping cart for a shopping website) or to record the user’s browsing history etc. This request will also contain additional information such as browser identification (User-Agent header), types of requests that it will accept (Accept header), and connection headers asking it to keep the TCP connection alive for additional requests.

Before moving on to the next step, it is important to mention firewalls. A firewall is a system that provides network security by filtering incoming and outgoing network traffic based on a set of user-defined rules. In general, the purpose of a firewall is to reduce or eliminate the occurrence of unwanted network communications while allowing all legitimate communication to flow freely. In most server infrastructures, firewalls provide an essential layer of security that, combined with other measures, prevent attackers from accessing your servers in malicious ways.

The server contains a webserver (i.e., Apache) and an application server that receives the request from the browser and passes it to a request handler to read and generate a response. A web server accepts and fulfills requests from clients for static content (i.e., HTML pages, files, images, and videos) from a website. Web servers handle HTTP requests and responses only. An application server is system software that resides between the operating system (OS) on one side, the external resources (such as a database management system [DBMS], communications and Internet services) on another side and the users’ applications on the third side. A website that provides both static and dynamically generated content (e.g https://www.google.com) runs web servers for the static content and application servers to generate content dynamically.

The request handler is a program (written in ASP.NET, PHP, Ruby, etc.) that reads the request, its’ headers, and cookies to check what is being requested and also update the information on the server if needed. Then it will assemble a response in a particular format (JSON, XML, HTML).

Usually, when you connect to a website these days, you’re actually using HTTPS instead of just HTTP. This is, in fact, not a different protocol from HTTP, but HTTP with a layer of encryption on it. That is to say, that if you just use HTTP, web data is exchanged “in the clear,” or in other words, in a way that anyone and everyone could read. There’s nothing in particular about an internet or HTTP connection that’s direct or exclusive to the two endpoints of the connection. Remember, the internet and the web are distributed. That’s one of their strengths. And web data gets relayed, routed, and otherwise intercepted all along the circuitous path they often take to get from a server to your browser.

Get Joshua Ngene’s stories in your inbox

Join Medium for free to get updates from this writer.

That’s where HTTPS comes in. HTTPS adds another protocol to the mix — TLS, or as it’s often better known, SSL — which is a process that can be used to make all the data sent and received between a web server and a web browser secret to everyone except them. TLS/SSL does this by encrypting the data, which means encoding the data using a secret cipher.

TLS/SSL uses public key encryption, which employs complicated mathematics such that both sides of the communication can encrypt data that the other can decrypt without ever having exchanged their ciphers with each other.

When you enter a URL in your browser and it uses “HTTPS” for the protocol, your browser and the server then also carryout the protocol for establishing a secure connection using TLS/SSL.

In some cases, in order to add redundancy to the infrastructure, more than one server is used and a load balancer is used to distribute incoming traffic between the servers. A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.

Finally, once the TCP connection, HTTP connection, and HTTPS connection are all established, your browser will receive the data from the server located at https://www.google.com. The response from the server contains the following:

  • a status line, telling the client the status of the request
  • response headers, telling the browser how to handle the response
  • the requested resource at that path, either content like HTML, CSS, Javascript, or image files, or data

Once the browser has received the response from the server, it inspects the response headers (e.g Content-Type) for information on how to render the resource. The browser then displays the content on the page.

All these steps happen each time we enter any URL and these processes happen in the background and within milliseconds.

Below is an illustration depicting the process:

Press enter or click to view image in full size

I hope you enjoyed this post?