What happens when in your browser you type any URL and press enter?

Juan Felipe Prado Cruz
7 min readSep 7, 2021

At some point in our life, we have used the web, and it’s crazy how you can find anything in there. But have you wonder what is the whole process is going on, or how the web works. Well, it is not magic and is a big process going on when we search a website. We are going through using as an example the URL https://www.holbertonschool.com but first, we must understand where the web lives.

Servers

You might think that websites are stored in space or the cloud, but they are stored in servers. A server is a computer without a screen, keyboard, or mouse that provides resources, data, services, or programs, over a network. Servers are in data centers which is a physical facility that hosts hundreds of severs. This place ensures that servers are in good and functional condition, and to keep them cool, since the servers have to do a lot of works, so they get overheat frequently. So now you know that when you visit a website you are entering a computer that hosts the website. Great but how do you connect to these servers?

Establishing a connection

To connect to a server and get its contents we must follow a protocol. TCP/IP is a suite protocol that allows computers to communicate on a network. So, to understand this a little more, let’s check out the URL that we are using.

A URL is Uniform Resource Locator is a user friendly stand in for an IP address, that serves as the webpage’s actual location on the internet, but wait what is an IP address, we will see it later, let’s see the parts of our URL. Protocol, tells the web browser what type of server we are connecting to. Domain, the website’s name. The path this the folder structure of the website, tells what which subfolder to find the webpage. There are more things about a URL you can check here.

As you can see the URL gives us the location of the website. The browser reads and connects to the location, the process goes throughout the different parts of the URL, first let’s check how it finds the website.
As we previously see the domain gives us the name of the website, and the browser will know where to connect. It is like magic, but all this happens thanks to the IP address. An IP address is a unique address that identifies a computer and allowing communication with each other. It consists of a set of numbers separated by periods (18.204.177.203). This language is used by the browser to understand to connect to the server. Imagine if you want to visit a friend’s house you need to get the address of his/her house to reach its destination. Here it is the same thing you need to get the IP address to access the website. But we never pass a number into the URL, so here is what does the domain is to point to the IP address and when passing the domain to the browser it retrieves the IP address to it. This is all done by the DNS.

DNS

Imagine if we must remember a number for accessing Facebook or a website that we just visit. It would be a lot harder because we as humans is more difficult to remember numbers than names, so that why just type the website’s site instead of IP address. For this to accomplish the DNS resolves the names to the IP address so we can access the website easily. DNS or Domain Name System works in the following steps

  1. A request was made for www.holbertonschool.com and the browser will check in its cache if the website has been previously visited, if not then it will route the request to the `DNS` resolver.
  2. The DNS resolver will check in the ISP (Internet Service Provider) if any user has visited the website before.
  3. The DNS resolver will request the website again to one of the TLD (Top Level Domain) name servers for .com domains. The TLD server refers to the last segment of a domain, the part after the dot symbol, in our case is the .com. This TLD responds with a response with the name of the NS or Name Servers where the IP address for the domain will store.
  4. The DNS resolver forwards the request to the NS servers. This will check the request and it will return to DNS resolver the IP address of the website.
  5. The DNS resolver finally has the IP address and it is returned to the browser.

After all this process the browser will know what is the IP address and can find the location of the server which holds the website.

TCP

Now the browser can communicate with the server, but first, we need to determine how the information or messages are going to transport. Here it comes TCP that stands for Transmission Control Protocol is a standard communication that lets programs and computing devices exchange messages. Its functionality works by sending data into packets and establishing a connection between server and client (in our case the browser). TCP guarantees that every packet has reached its destination, if not it will send another with the same data that was lost. This is why the internet use TCP to display the contents of a website so you will not get a webpage with incomplete content. Once the transport is ready, it can communicate with the server.

HTTPS

To communicate with the server, we need a protocol to make the communication or speaks with the server, here comes the protocol part in the URL. HTTPS stands for Hypertext Transfer Protocol Secure is the secure version of `HTTP`, first, we need to know what is just HTTP. The Hypertext Transfer Protocol is for transmitting hypermedia documents. HTTP involves the client requesting a server, which will send a response message. To understand this, when we are accessing a website, we are requesting to that website’s server the contents of it, this is called an HTTP request. Then the server will send a message if the request was approved or there was an error, this is the HTTP response. For more details, you can check here. So, what is the difference between them, well, as we see one is secure and the other is not. When using HTTP all the information that is sent through it can be fetched and stole by a hacker since the information has not any security. While using HTTPS this protocol adds security by encrypting the data that is sending and just can by the destination server, if the hacker obtains the data, it will be impossible to decrypt for the hacker. When you access a website and see a locker in the upper left it means that your information is secure and using HTTPS if not you might see a message that the website is not secure, and your information can be capture by a hacker.

When the browser knows where to find the website and to communicate with the server, the browser will send a request header to the server. This request when is in the traffic to reach its detitanation may have first entered to a Load Balancer, this service will distribute the incoming traffic to different web servers of the website, every one of these servers has the same information. Since there may hundreds of thousands of requests from the clients this can affect the server by overhitting it will stop working, to avoid this the Load balancer manages the request sending to different servers with the same information, so in this way, the servers are not frequently to break. When the request passes the `load balancer` and it’s about to reach the web server the request might be inspected by a firewall this can be hardware or software that permits or blocks data packets based on the security rules. When the request was accepted by the firewall it will enter to the web server. The `web server` is software or hardware that uses HTTP and other protocols to respond to the client request that was made. In our case, the web server will respond with the main contents of the website www.holbertonschool.com. So, the web server that receive the request was made it, if it okay will respond with the contents if there is any error will respond with the error made. After this, if you request some data that are store in databases the request will travel until the server that holds the database and responds with the data needed to the client request.

This is all done in a blink of an eye, it is extremely fast, and that’s a small guide of what happens when you type a URL and hit enter, I hope now you understand a little a bit more of how the web works.

Resources

Here you can find some resources to keep growing your knowledge.

--

--