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

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

We do it all the time while on the internet. We write down the URL (Uniform Resource Locator) for the website we want to visit like its completely normal and depending on your internet speed it can give you what you want in practically no time. But how does it actually work? How are we able to get the website that we want every single time just by entering the URL needed? In that short amount of time it can be surprising all the things that occur.

Understanding the Client-Server Model

No alt text provided for this image

In order to better comprehend everything that we will discuss it would be best to start by understanding the client server model. The client-server model is a structure that partitions or divides the different workloads and tasks into clients and servers. A client can be seen as a service requester while a server is a provider of the service being requested which also stores the data and manages most of the processing of this data. In essence the way the internet would work when it comes to looking for a website would be the same since the user's computer or browser (for example) is the client and the computer program serving data as well as the physical machine on which the server program is running is the server. Each service may have multiple servers at disposal working behind the scenes to perform the tasks and processes requested by the client.

URL to IP Address

It would be best to start off by clarifying that the actual "name" or way to identify one website from another is through a designated IP Address. Which in very short terms is a string of numbers and periods that helps differentiate one site from another.

"An IP address is a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the internet or local network. In essence, IP addresses are the identifier that allows information to be sent between devices on a network: they contain location information and make devices accessible for communication. The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works." - https://www.kaspersky.com/resource-center/definitions/what-is-an-ip-address

So lets start of from the very beginning. First off a person (or user) types down the URL of the website wanting to visit into its preferred web browser on his/her computer (which can be considered the client for this example). Computers and other devices tend to communicate with each other using IP addresses that help to identify from one and another. Due to the users (humans) being unable to memorize every single IP address there is then it is easier to work with words that make sense to us. Now before getting into the website we must convert a URL into an IP address and that is where the DNS comes in.

No alt text provided for this image


No alt text provided for this image

When we type https://www. holbertonschool.com and press enter the DNS (Domain Name System) will translate human-adapted, text-based domain names to machine-adapted, numerical-based IP. But before doing so we need to divide things up in steps.

  1. Browser cache: After pressing Enter the browser will first verify if it already has the information for the IP address stored in its cache. If unable to locate it the it will then verify with the OS (Operating System)
  2. OS cache: The OS will therefore do the same as the Browser and if unable to locate the IP address in its cache then it will assign the task of finding it to the Resolver.
  3. Resolver: The Resolver, usually your Internet Service Provider (ISP), will also verify if it already has that information stored on hand and if not will search in the root server. The resolver will be in charge of "resolving" the task of locating the IP address in the other locations explained.
  4. Root server: The root server will also work on the same process to see if it can provide the information and otherwise locate the TLD server.
  5. TLD Server: If the TLD server or Top-Level Domain Server does not know the IP address then it can point us to the Authoritative Name Servers via the domain registrar. The domain registrar is where the domain names are reserved after being purchased and it communicates to the TLD server the Authoritative Name Servers which can be many.
  6. Authoritative Name Servers: Provide answer to DNS queries. 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.
  7. Retrieve IP and bring back: Once resolver obtains the IP Address from the authoritative name servers it saves the IP Address in its cache to bring back to the OS. Once the OS receives the IP Address from the resolver it will then send back that same IP to the browser which will also save in cache. Finally, the browser will proceed with connecting with that IP Address and requesting the desired content to the corresponding server.

TCP/IP

We have obtained the IP Address for https://www.holbertonschool.com we proceed to connect and request the website but in order to do so there are some protocols we have to follow. TCP/IP (Transmission Control Protocol/Internet Protocol) is a set of standardized rules that define how servers and clients interact and communicate over the network (internet). We already covered IP and how it obtains the address to which we send and receive data. On the other hand TCP is in charge of how the data will be delivered, received, ordered and broken into packets and checked for errors in the network.

Firewall

No alt text provided for this image

Protocols aside, part of the process of when servers and clients interact is going through the firewall. The Firewall is a network security software or system that is designated to prevent or prohibit unauthorized access to a part of a network. If we continue with our example, part of the process of connecting and interacting between the user and the server that has the content for https://www.holbertonschoo-l.com is going through the firewall for security purposes.

HTTPS/SSL

No alt text provided for this image

We have discussed the DNS, TCP/IP and Firewall yet the browser up until this point has only covered the domain-name, top-level domain and sub-domain. HTTPS or HyperText Transfer Protocol Secure is a secure version of HTTP in which the communications between client and server are encrypted. Basically the https:// stands for this. This transfer protocol defines different types of requests and responses served to clients and servers over a network such as confidential online transactions.

Another main component from this type of protocol when it comes to 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. When a website has this certificate, we’re able to see depending on the browser a lock icon alongside the URL or the search bar may turn green.

Load-Balancer

No alt text provided for this image

Depending on the website there is a probability that it can have either one or multiple servers working at the same time. The reason for this would be for a way to control server traffic, attacks on a server or any other situation that may occur that can potentially harm a server. In order to avoid having a Single Point of Failure (SPOF), it is highly recommended to have a various servers that are being managed by a load-balancer. A load-balancer is a software that balances and distributes network requests or traffic between several servers, following a determined load-balancing algorithm. Examples of an algorithm would be one that which distributes traffic alternating between all the servers evenly and consequentially, or one that distributes traffic depending on the current server loads.

Server

No alt text provided for this image

Finally! We got past security and the load-balancer was able to distribute our request to an available server. But what now? Server can consist of a very general term when it comes to this process and how it works. Websites consist of static and dinamic content that help the user interact with the website and the information. As for the information itself it is stored inside a database. So we would need to cover these three components of a overall server.

  • Web Server: The web server will be the one that provides us with the static content of the website such as HTML files. An example of web servers are Nginx and Apache.
  • Application Server: The application server is in charge of making the website more dynamic and less dull and boring by allowing the user to interact with the website. Some of the uses of an application server is operating applications, communicate with databases and manage user information, among others. By working behind the web servers they are able to use the static content to return a dynamic application to the web server.
  • Database: You have a functioning web server and application server but what happens with all the data that the user enters or wants to see? A database or database server is highly needed in order to store, extract and manipulate information. Database in its own terms is a collection of data, but in order to view, modify, add or delete data a database management system is the way to go.

With all this we can now have a general understanding of what happens behind the scenes when you type https://www.holbertonschool.com in your browser and press Enter. And more surprisingly is that depending on your internet connection speed this all can be done in second or less. Web Stack developent is very interesting and consists of various layers from which we are just getting started. This blog is purely for the understanding of these concepts and I take no credit whatsoever from the images used here. Nonetheless happy coding.

要查看或添加评论,请登录

Xavier E. Figueroa Muniz的更多文章

社区洞察

其他会员也浏览了