What Happens When You Type an URL and Press Enter?

Van Phan
7 min readAug 24, 2019

--

Source: spyserp.com

The Internet is an important part of people’s life nowadays. Typing an URL (Uniform Resource Locator) to go to a website is an obvious action for everybody. However, have you ever wondered what happened from the time after you hit enter to when the webpage appears on your browser? What is the process during that time?

In this article, the process will be explained and broke down step by step. I will use “ https://www.holbertonschool.com” as an example.

DNS - The Translator

Before we jump into DNS (Domain Name System), we need to find down the structure of the URL.

Source: https://outspokenmedia.com

A basic structure of the URL is made from protocol, subdomain, domain name, and top-level domain (TLD) and they are characters and words. However, our machines or computers cannot understand words, so each URL is assigned with a unique IP address. Each IP address is made by 4 numbers separated by “.” delimiter, and each number can be from 0 to 255. For example, 216.3.128.12 or 192.0.2.1 is a valid IP address.

Instead of typing the URL, you can access a website by typing its IP address into your browser bar. Now, we know that each URL has an IP address, but where are all IP addresses stored? The answer is the DNS (Domain Name System). DNS is a naming system database that stored all domain names and translated them into IP addresses. The DNS is the phonebook of the Internet. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources. Because of the DNS, everybody doesn’t have to remember all the IP address, instead, they just need to remember the domain name of the website.

One step before requesting the DNS

When we type the URL such as https://www.holbertonschool.com into the address bar of the browser (Firefox, Chrome, Opera, etc), the system will check for the DNS record.

The first place that the browser will check for the DNS record is its cache. The cache is the place that temporarily stores all IP address of websites that you recently visited. If the browser cannot find the IP address in its cache, it will check for the OS (operating system) cache by making a system call to computer OS. After checking on the OS system, the browser will check on router cache if it cannot find on your computer. The last way to look for any DNS record after checking all the above cache, it will check Internet Service Provider (ISP) cache.

The time to request the DNS

Now we jump to the next step to find the DNS record after searching all cache sources above. The browser will search recursively through the Internet from the lowest level to the highest level. The ISP will request a DNS query to go through multiple DNS servers to find the correct IP address.

If it finds the correct IP, it will respond back to the browsers. If not, the ISP will connect with a root name server. Based on the information of the root name server, it will be redirected to Top-Level Domain server such as .com, .org to find the IP address that the browser wants. if not, it will send you a request error.

TCP/IP: The transmission

Now, your browser receives the correct IP address, it will set up a protocol between the website server and itself. This protocol will create communication and transfer data and information between them. There are many types of network protocols, but the most popular is the TCP/IP (Transmission Control Protocol/Internet Protocol).

Source: ccnablog.com

The TCP/IP model specifies how the application creates channels of communication across a network. Therefore, establishing a TCP connection is very important. The TCP will handle your request and the data will go through a series of layers so that it can be properly transferred. The data will be assembled and broken into smaller packets so that it can pass through the transport layer. Once the packets are ready, they will be transmitted through WiFi, Ethernet, or a cellular data network. Now, the IP will manage the route and address for each packet to transfer to the right location. When all the packets reach the right location, they will be reassembled in the right order at the destination address.

Here are four layers of TCP/IP functionality:

The application layer provides applications with standardized data exchange included Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), Post Office Protocol 3 (POP3), Simple Mail Transfer Protocol (SMTP) and Simple Network Management Protocol (SNMP).

The transport layer is responsible for maintaining end-to-end communications across the network included TCP and User Datagram Protocol (UDP).

The network layer, also called the internet layer, deals with packets and connects independent networks to transport the packets across network boundaries included the IP and the Internet Control Message Protocol (ICMP).

The physical layer consists of protocols that operate only on a link — the network component that interconnects nodes or hosts in the network included Ethernet for local area networks (LANs) and the Address Resolution Protocol (ARP). (*)

HTTPS - SSL - TLS

Now, you have established the TCP/IP connection to transfer data. Based on the website protocol scheme, your browser will send an HTTP ( HyperText Transfer Protocol) or HTTPS ( Hypertext Transfer Protocol Secure) request to the website servers. Both HTTP and HTTPS are protocols using which hypertext is transferred over the Web. However, most of the websites have been using HTTPS for security reason, because a third party (such as hackers) can intercept and manipulate transferred data if websites use HTTP ( port 80).

By using HTTPS (port 443), the data has been encrypted with SSL (secure socket layer) or TLS (Transport Layer Security) which is an improved version of SSL. This process is also SSL (or TLS) handshake. The handshake helps your browser (client) verify the SSL certificate of the website and if it is valid, all data transfers between your browser and server will be encrypted.

We reach the server but wait!!! More security!!!

After going through all the steps above, your HTTPS request has reached the server, but this server is not a web server, it is a load balancer (HA proxy, Seesaw,..). This is the first checkpoint of the website. The load balancer improves the traffic and workload distribution across multiple web servers of the website by using its algorithms such as Round Robin or Random. The purpose of the load balancer besides distributing the traffic is to prevent a single point of failures which means that if a web server is down, the load balancer can redirect to another web server.

Firewalls

Source: iconfinder.com

When you reach the load balancer, a firewall will show up to protect the load balancer. A firewall, which can be software or hardware, scan and check data or requests to prevent viruses, malware, or suspicious request coming into web servers and also restrain sensitive information coming out. The firewall creates a filter to allow a certain port to access the server. Besides establishing the firewall in the load balancer, we can also set up firewalls for all web servers.

HTTP response

After going through the load balancer, your HTTPS request can access the webserver. A webserver (Nginx, Apache,…) is a place which stores all HTML and CSS of the website. After receiving the request, the webserver will response a static webpage to your browser. You will see the display of the HTML content.

Dynamic Content

If you want dynamic content, the web server will communicate with an application server to solve business logic. An application server may run with different programming languages such as Python, Java, PHP, and so on. Just like the webserver, a website can have many “clusters” of application servers storing in many different machines to avoid the single point of failure.

It’s query time

Last but not least is a database server. The database server helps the website manage, control, update and handle data request. It often uses data applications such as MySQL, MongoDB, PostgreSQL, SQLite, etc to handle database. Just like the web server and application server, we need multiple database servers to prevent the single point of failure.

That’s it.

We just go through the basic process when you type an URL to your browser’s address bar. Thank you for reading this article.

Source

https://www.cloudflare.com/learning/dns/what-is-dns/

--

--