What happens when…?

Daniel Celis Tobon
5 min readJan 9, 2020

Human beings are curious by nature, and I am sure all of us at some point in our lives have asked ourselves the following question: What happens when we type something in our browser and press enter? For this reason, the main topic of this blog will be around this question and we will go deep into topics such as DNS request, TCP/IP, firewall, HTTPS/SSL, load balancer, web server, application server and databases.

So first, we will go over some basic web stack concepts and then see how they all work together.

DNS (Domain Name System) translates the domain name to IP address so browsers can load internet resources. The websites are hosting under IP addresses, remembering the IP address of each web page would be too difficult for human beings, so the DNS was create to allow the creation of names that are easier to remember.

IP address is a unique identifier to send data to specific computers on a network. There are two standards for IP addresses: IPv4 and IPv6.

  • IPv4 uses 32 binary bits to create a unique address on the network. It is express by four numbers separate by dots. Each number is a decimal (base 10), for example, 127.0.0.1.
  • IPv6 uses 128 binary bits to create a unique address on the network. It is express by eight groups of hexadecimal (base 16) numbers separate by colons, for example, 2001:cdba:0000:0000:0000:0000:3257:9652.
    Note: groups of numbers that contain all zeros are often omitted to save space, leaving a colon separator to mark the gap, for example, 2011:cdba:: 3257:9652.

TCP/IP (Transmission Control Protocol / Internet Protocol) is a suite of communication protocols used to interconnect. It provides apps a way to deliver (and receive) an ordered and error checked stream of information packets over the network.

Firewall is a software that is designing to block unauthorized access, while allowing authorized communications from a computer to the network and from network elements to the computer.

HTTPS (Hyper Text Transfer Protocol Secure) is the secure version of HTTP, the protocol over which data is send between your browser and the website that you are connect. The “S” at the end of HTTPS stands for “secure”, it means all communications between your browser and the website are encrypt.

SSL is a security protocol used to establish a secure session that requires minimal intervention by the end user, for example, the browser alerts the user to the presence of an SSL Certificate when a padlock is display or when the address bar appears in green.

Load balancer is a hardware or software device that is place in front of a set of servers serving an application. As its name implies, it assigns or balances the requests that come from clients to servers using some algorithm, for example, the Weighted Round-Robin (with this algorithm the requests are deliver depending on the weight given to each server).

Web server is a software in charge of receiving the requests and returning the response to the user by means of the HTTPS protocol.

Application server is a software in charge of loading, compiling and executing the code when we have an application or a dynamic web page (that has code or processes in python or other programming language).

Database is an organized collection of data, generally stored and accessed electronically from a computer system.

What happens when you type https://www.holbertonschool.com in your browser and press enter?

When a user types https://www.holbertonschool.com in the address bar and presses enter, the browser looks in its cache to see if it knows the IP address of this website, otherwise the operating system checks the host files. If the IP address is not found in either, the browser makes a request to the DNS solver (which is usually managed by the internet provider), first makes a visit to the root, then to the place where the .com domains are located and finally to the assigned DNS servers. DNS servers convert name requests (based on the ‘cname’ and ‘a’ records) into IP addresses and control which server the user who types the domain name will go. The DNS solver obtains the IP address that the user needs and returns that information to the browser. The DNS solver also caches the IP address of the domain so that it can respond more quickly the next time someone searches for it.

Image provided by Wikipedia

Now having the IP address, the browser sends a request to the website’s servers via the HTTPS protocol (which provides us with greater security when transferring information, since the text and information shared will be encrypt). This request will initially arrive at a load balancer, which by means of an algorithm (for example: Round-Robin, Weighted Round-Robin, LeastConnection, Weighted LeastConnection) sends the request to one of the servers provided by the website.

Then the request is receive by the web server, this is responsible for showing the client a visualization of the website, based on the existing code in the application server and this is responsible for integrating all the code HTML, CSS and Javascript for the graphic part of the website, as Python or other programming languages that allow the use of functions and processes for the full functionality of the website and also linking the Mysql database.

Finally, the connection between the client and the server is build. Now, both can communicate with each other and share information. After a successful connection, the client continues to send requests to the server so that it can move around the website. The server knows all about the response it must send for each request, so the server responds. This response contains all the information that you requested such as web page, status code, cache control, etc. Now, the browser shows the content that has been request, in our case initially showing us the home page of Holberton School, and later showing us the content that we want to access.

Home page of Holberton School

--

--