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

DNS request
When you type holbertonschool.com into your browser and press `enter`, and since any domain name on the internet has an unique IP address, before anything the browser will check the cache for DNS record to holbertonschool.com’s matching IP address. The IP address of the computer that hosts the server of the holbertonschool.com website.
DNS’s main purpose is human readability. It’s not that easy to memorize the set of numbers to access different website. DNS just connects domain names to their IP addresses.
How does this work:
- Browser caches are checked to see if you have visited the website previously, if so, the DNS record will be found.
- If no records were found, your browser will make a system call to OS that maintains a cache of DNS records.
- Checks router cache if no records found on your computer.
- If not found in any above caches it will check Internet Service Provider (ISP) cache.
Recursive DNS search:
If holbertonschool.com’s IP address is not in the cache, then ISP’s DNS server will initiate a DNS query to find the IP address of the holbertonschool.com host server. DNS query will search multiple DNS servers until it finds the holbertonschool.com IP address. If the IP address was not found DNS will return an error message.
- TCP/IP
Once the browser receives the corresponding IP address it will use internet protocol to make the connection with its server to transfer the data. TCP is the most common protocol used for any type of http request.
To transfer data between your computer and the server you need to have a TCP connection established. This process is called TCP/IP tree-way handshake:
- Your machine sends a SYN(synchronize) packet to the server over the internet asking if it is open for new connections.
- If the server has open ports that can access and initiate new connections, it will respond with ACL(acknowledgement) of the SYN packet using a SYN/ACK packet.
- Your machine will receive the SYN/ACK packet from the server and will acknowledge it by sending ACK packet.
Now you have TCP connection established for data transmission.
Firewall will filter the incoming and outgoing traffic to make sure nothing unwanted was sent or no one tries to hack your website . (to edit)
SSL that stand for Secure Socket layer provides a secure connection through HTTPS. We install SSL on every server. (to edit)
When the TCP connection is established, the data can be transferred. The browser send the http request to the web server. Your browser send `GET` request asking for holbertonschool.com web page. It sends a `POST` request if the user trying to log in for example.
The server, that contains a web server, receives the request from the browser and passes it to a program, that handles requests, to read and generate a response. This program reads the request, cookies, it’s headers to check what was requested (if necessary it updates the information on the server) and assembles a response in one of the formats: JSON, HTML, XML.
The server sends out an HTTP response, which contains the web page you requested as well as the status code, compression type (Content-Encoding), how to cache the page (Cache-Control), any cookies to set, privacy information, etc.
Load-balancer is a piece of software that runs on it’s own server and it helps distribute the traffic among all web servers. (to add)
Web server uses HTTP to serve html files to users, in response to their requests.
Application server translates (for example) python program into html code. So it could be passed to the web server and then to user.
Database is used to keep, control, edit and manage data.
