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

joel silva
7 min readSep 12, 2021

We use internet all the time for all sorts of purposes, and it has become like a second nature to browse all day. So much so that we’re most of the time content with just knowing that our browser works and does what it’s asked. But it’s not magic (or is it?), and the web pages we see in that rectangle machine must come from somewhere. So how is it all happening? What is happening under the hood between the moment we enter a URL (Uniform Resource Locator) in the search bar and the moment we receive the content of the desired page?

— The client-server model

Before diving into the details of the web infrastructure, it’s important to understand the client-server model. On the World Wide Web, the network is organized between clients, which request data, and servers, which stores the data and manages most of the processing of this data. For example, a browser is considered a client, and a server would be the computer program serving data to that client. Server is also a term describing the physical machine on which the server program is running. Each website, application, service can have multiple servers working behind the scenes to perform the processes needed by the client(s). In general, physical servers are regrouped in server farms, or data centers.

-Example of client to server communication

There are many other layers between the client and the server in a client-server model, let’s break is down.

— The DNS request

When we type the URL https://www.holbertonschool.com into our browser (Google, Firefox, Safari, or any browser) and press ‘Enter’, the first thing that the browser is going to do is break down the URL in pieces. The browser is going to consider the www.holbertonschool.com part first, which is a domain name. If the browser doesn’t know that domain name (it’s not stored in its cache), it is going to ask the Domain Name System for the IP address corresponding to this particular domain name. This IP (Internet Protocol) address is in fact the unique address of the main server hosting the website (the data, the text files, the code, the services…) www.holbertonschool.com. It’s a suite of four numbers ranging from 0 to 255, separated by dots. The reason we have domain names in the first place is because humans remember words better than numbers. Thankfully, the DNS is here for us to remember the IP of each domain.

The DNS request first goes through the resolver. The resolver is usually our Internet Service Provider, and if it doesn’t find the IP in its cache, it’s going to request the root server. The root server knows where the TLD (Top-Level Domain) server is. In our case, the top-level domain is .com. Other types of TLD are .net, .fr, etc. If the TLD server doesn’t know the IP, it points the resolver to the Authoritative Name Servers for the domain name. Usually, there is more than one name server attached to one domain name. But any of those name servers can give the IP for the domain name they are attached to. Now the resolver has the IP address(for example, 54.172.4.191), and can send it back to the browser which will perform its request to the corresponding server.

— Protocols: TCP/IP

We mentioned how domain names actually represent IP addresses, but IP is not the only type of protocol use by the Internet. The Internet Protocol Suite is often referred to as TCP/IP (TCP stand for Transmission Control Protocol), and it also contains other types of protocols. It’s a set of rules that define how servers and clients interact over the network, and how data should be transferred, broken into packets, received, etc.

— The Firewall

To protect themselves from hackers and attacks, servers are often equipped with a firewall. A firewall is a software that sets rules about what can enter or leave a part of a network. In the case of our example, when the browser asks for the website at the address 54.172.4.191, that request has be processed by a firewall which will decide if it’s safe, or if it’s a threat to the server’s security. 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.

— Load-balancer

As we mentioned earlier, websites live on servers. For most website where the traffic is consequent, it would be impossible to be hosted on a single server. Plus, it would create a Single Point of Failure (SPOF), because it would only need one attack on said server to take the whole site down.

As needs for higher availability and security rises, websites started augmenting the number of servers they have, organizing them in clusters, and using load-balancers. A load-balancer is a software program that distribute network requests between several servers, following a load-balancing algorithm. HAproxy is a very famous load-balancer, and example of algorithms that we can use are the round-robin, which distributes the requests alternating between all the servers evenly and consequentially, or the least-connection, which distributes requests depending on the current server loads.

— The Web server

Once the requests have been evenly distributed to the servers, they will be processed by one or more web servers. A web server is a software program that serves static content, like simple HTML pages, images or plain text files. Examples of web servers are Nginx or Apache. The web server is responsible for finding where the static content corresponding to the address asked for is living, and for serving it as an HTTP, or HTTPS response.

— Security and Encryption: HTTPS/SSL

Now that the browser has the IP address, it is going to take care of the other part of the URL, the https:// part. HTTPS stands for HyperText Transfer Protocol Secure, and is a secure version of the regular HTTP. This transfer protocol defines different types of requests and responses served to clients and servers over a network. In other terms, it’s the main way to transfer data between a browser and a website. HTTP and HTTPS requests include GET, POST, PUT, and others. The HTTPS requests and responses are encrypted, which ensure the users that their data can’t be stolen or used by third-parties. For example, if we put our credit card information in a website that uses HTTPS, we are guaranteed that this info is not going to be stored in plain text somewhere accessible to anybody

Another key component in securing websites is the SSL certificate. SSL stands for Secure Sockets Layer (also known as TSL, Transport Layer Security). The certificate needs be issued from a trusted Certificate Authority, like the famous Let’s Encrypt for example, which gives free SSL certificates. When a website has this certificate, we’re able to see a little lock icon next to the website name in the search bar. On some browsers and with certain types of SSL certificates, the bar turns green.

— The Application server

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 into it, log in with a user name and a password, etc.

This is made possible by the use of one or more application servers. These are software programs responsible for operating applications, communicate with databases and manage user information, among other things. they work behind web servers and will be able to serve a dynamic application using the static content from the web server.

— The Database

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 is going to interact with the database and retrieve, add, modify data in it.

There are several types of database models. The two main ones are relational databases, and non-relational databases. A relational database can be seen as a collection of tables representing objects, where each column is an attribute and each row is an instance of that object. We can perform SQL (Structured Query Language) queries on those databases. MySQL and PostgreSQL are two popular relational databases. A non-relational database can have many forms, as the data inserted in it doesn’t have to follow a particular schema. They are also called NoSQL databases.

END.

--

--