0x11. What happens when you type holbertonschool.com in your browser and press Enter
Have you ever wondered, what happens exactly once you write an URL in your browser tab ?
Today we are going to explore deeply the the whole process of web/url mechanism and how things works under the hood .. for the sake of clarity we are going to use Holberton School URL as an example.
Type the URL on your Browser :
Once you type https://www.holbertonschool.com in your web browser, a very complicated chain reaction is triggered to get the web page loaded :
Check the DNS servers for the ip adresse:
- Your browser asks your computer where the domain name (www.holbertonschool.com) is located.
- If your computer does not know, it asks your DNS server. Your DNS server is set up when you connect to the Internet, and it is usually provided by your Internet Service Provider (ISP). A DNS server is like a phone book with records of the IP addresses for many different domain names.
- If your ISP’s DNS server does not know where www.holbertonschool.com is located, it asks the Internet registration authority who has the authoritative records for holbertonschool.com.
- The Internet registration authority tells your ISP’s DNS server who maintains the address records for holbertonschool.com. In this case, a server with domain name “us-east-1.elasticbeanstalk.com.awsdns-07.com. maintains holbertonschool’s records”. This is called a nameserver
- Your ISP’s DNS server then asks the nameserver where www.holbertonschool.com lives. www.holbertoschool.com has an IP address of 54.88.73.204
- Your ISP’s DNS server then sends this IP address back to your PC. Your PC stores the IP address in its local cache (its local address book).
How DNS Records works ?
It’s very important to mention, that we used two types of representation of www.holbertonschool.com :
The first is the readable form which basically a string containing only characters , this actually the domain name of holberton website … but in reality a domain name is just an “alias” of the unique IP address of the website which is 54.88.73.204(the address of the server hosting this website) …
In fact, domain names serve to identify Internet resources, such as computers, networks, and services, with a text-based label that is easier to memorize than the numerical addresses used in the Internet protocols.
Technically, holbertonschool is called also a record, pointing to the ip adresse of the host server … and every record of type A resolves to IP address .
The web browser makes HTTP Requests to retrieve the website content:
Once the browser (called also client), has the the ip adresse of the server hosting the website, a GET request is submitted by establishing a Transmission Control Protocol (TCP) connection to the port 80.
This GET request is received by a piece of software/hardware called web server …
The webserver respond to the emitted Http requests:
This webserver ensure listening on port 80, waits for a client’s request message. Upon receiving the request, the server sends back a status line, such as “HTTP/1.1 200 OK”, and a message of its own. The body of this message is typically the content of holberton school website, although an error message or other information may also be returned.
A piece of hardware is placed between the client and server to ensure several tasks:
For redundancy , security and scalability purposes, a load balancer is usually placed between the client and the server … 3 main tasks are performed with this implementation :
Secure the HTTP and encrypt the transferred data using HTTPS:
1- Most of the time, the load balancer has an SSL certificate installed on it to performs encryption and decryption of data transported via HTTPS, which uses the Secure Sockets Layer (SSL) protocol to secure the exchanged data between the client and server .
The connection to the server is equally distributed
2- For such a widely visited web site like www.holbertonschool.com, and in order to ensure redundancy and high availability of the website, multiple copies of the website are hosted in different servers … To ensure an equal distribution of the incoming traffic and avoid single point of failure, all the servers are placed behind the load balancer .
Filter the incoming traffic:
3- For security purposes, a firewell is placed behind the load balancer to filter the incoming traffic and manage the active ports on the server .
Retrieve the website content from the DATABASE:
And here we come to the last piece of the puzzle, once the request passes through all the steps listed above, the content of the website is retrieved from database connected to the server …
Although this seems like a very tedious prolonged process, we know that it takes less than seconds for a web page to render after we hit enter on our keyboard. All of these steps happen within milliseconds before we could even notice.