What happens when you type holbertonschool.com in your browser and press Enter
Jose Alfredo Vallejo Contreras
Developer | Node | TypeScript | Nest | Angular
When you want go to visit a web page, in your web explorer and in the network happen many things in background for show all the information that you request. In this blog we let know each process.
Let's go talk about the different step (1 to 12) for stablish connexion whit the web server holbertonschool.com, after we will see what happen in the Holberton web server for proceed you request (step 13 and 14):
- After the release the enter key, your web explorer will be try resolve the DNS for the domain input in his cache memory. In this point we have two words that is important recognize, domain and DNS, What is this?. Domain, the communications in internet are between devices connecting using tcp/ip protocol, they are linked using the IP address. It's a group of number that identify logic and hierarchical each device connecting to public or private network, the problem whit the IP address is that is hard for the human remember many numbers combinations, and for conventionality was stablish use words instead of number, these names given to the IP are named domains, and the DNS is a server that record all domain and his respective IP address.
- If you are visiting the site for first time or if has installed the web browser this not have record the DNS in your cache memory, and will be must DNS request resolver in your pc, depend on operative system this file will be in specific directory.
- When DNS don't can resolve locally is necessary send to DNS request to primary DNS server. Each ISP (Internet service provider) supplier IP address of server DNS. But what is primary DNS server, this is the first point of contact for a web browser, application or device that needs to translate a human-readable hostname into an IP address. The primary DNS server contains a DNS record that has the correct IP address for the hostname.
- The primary DNS server check if have the record with domain and ip request, else it must be resent to request to root DNS server
- All the servers DNS have a list whit the domain and ip, and this list is managed and update for ICANN, it's an organization that operates at a multinational / international level and is responsible for assigning the IP protocol addresses. The root server has the location of different DNS server organized for top-level record list (this the extension ej. *.com, *.net ...). Once get request it′s proceed for found the most nearly .com name server to primary server DNS, and this one responds by sending the ip where the request should be sent. For example if you want know where is the name server that have the register list whit your domain and IP, go to https://dnsmap.io/ and put in the search bar your domain and you can see the geographic place of name server DNS physical.
- When the primary DNS server get the answer of IP where it must be sent to request for resolve the domain, this is sent.
- The name server where has be sent the request must be the more nearly possible for decreased the latencies, is for that why server are placed in different geographic zones. En the next step (8) the primary name server get the answer and (9) sent request to website for check the work done, (10) when the website answer to primary server and the domain and ip are correct the information is (11) sent to web browser, once the information is get, this is saved (12) for the next time that you need access the same website, the system can resolve it locally.
Now is time sent request to web server www.holberton.com
In the image above we can see the architecture for an application web. In this point is very important that we have be clear the main differences amount web page, website and application web. A web page is static contend placed in some host provider, the website is when placed two o more web pages linked, but it not has interaction with user, for example if we need upload brochure or information about different project that we have been make. The application web is a complex architecture that is allowed for share information amount different devices or users and must share dynamic information of different topic, an example of app web must be Facebook, Holberton App web...
When the web browser has the IP, it sent the request using HTTP over TCP/IP protocol toward port 80 in the web server of web app holberton.com. In the path of connexion the request is allowed to get in through firewall to VPN. The firewall is the first filter, all time is monitoring incoming and outgoing traffic and only allowed connexion to port that admin to app web opened. After that request pass the firewall is get in the load balancer, this has the responsibilities of distribute all the requests to different web server config in his config file. The way how load balance work or redirect the request depend on of algorithm configured. The most common is roundrobin that sent the request sequentially one to one in order of last server selected, for example if you have two servers named web-01 and web-02 the load balancer first resent request to web-01, the next time to web-02 and replay again loop.
The web server get the request sent of the load balance and answer back. The process of response depends on the kind of request, for the first connexion the web server if has Let's Encrypt certificate this sends the public key through header to web browser stablish this way an HTTPS/SSL connexion, and the next request will be sent safety way between web server and your browser web. The main idea of https connexion is protected you sensitive information that can't be seen for anyone hacker in some break point between web server and your web browser.
The connexion between your web browser and site www.holberton.com o what ever that you need visit is similar, the site web is don't sent all in only one request. The first information in sent, is the html page whit your metadata and headers, then the information placed in header is request from web browser to web server and this use the resources allowed for given answer back info. The different recourse must be Application server, Database...