What happens when you type https://www.holbertonschool.com in your browser and press Enter?
A website is hosted on a remote server in a data center. In order to access this website, a client must have the IP address of that server. A website has a web address, in this case
www.holbertonschool.com, that corresponds to that IP address. The Domain Name System (DNS) is like an index that has all public websites and their corresponding IP addresses, so for a browser to use the web address to access a website, it must ask the DNS server to look up the IP address.
When a web address is typed into a browser, the browser checks the DNS cache on the current computer. If the cache contains the information for the website, it skips making a request to the DNS server. If the cache does not contain that information, the browser asks the operating system for the server’s IP address. The operating system then makes a DNS request to find the IP address associated with the web address and the IP address is returned to the browser.
The browser then opens a TCP connection on port 443 so it can send an HTTPS request to the server. The server responds with its SSL certificate and in turn the client responds with a session key encrypted with the server’s SSL public key. If the server can decrypt the client’s session key, it can confirm that information sent between the server and client are encrypted and that the connection is secure.
Next, the browser’s request passes through the server’s load balancer, which has the IP address associated with the web address. The load balancer distributes traffic across servers, allowing for site reliability and a larger capacity of users. The load balancer sends the browser’s request to a server that contains software that will serve webpages back to the client.
On this server, webserver software is the only part of the server that will communicate with the client. The webserver interacts with the codebase, the application server, and the database in order to display the content the client requests. If the client requests a static HTML page, the webserver interacts with the codebase to get the requested page to display to the client. If the client requests something requiring information from a database, the webserver interacts with the application server which pulls the necessary information from the database and returns it to the webserver in a format that it can display to the client.
In the case of
https://www.holbertonschool.com, the webserver will serve a static HTML page back to the client browser over a secure HTTPS connection.