Sunday, April 12, 2020

Typing an URL into your web browser?

What happens when you type an URL in the browser?

What Is A URL (Uniform Resource Locator)?

Today you are sitting at home trying to entertain yourself in the internet. You try Youtube.com for funny videos or read the news on CNN page. Access to all these pages is almost instant, seems like magic right? but it is not. In short, you are requesting access to view a web page every time you type a URL into the web browser. But how does it work? Short answer its complicated. Long answer it consists of several processes that go behind the scenes and occur in an instant.

The DNS

DNS stands for Domain Name System it involves connecting an IP address to a human readable name. An example of a DNS would be 0.0.0.0 being the IP address and its domain name would be EXAMPLE.com. All IP addresses are a series of numbers but they are to long to remember, therefore the DNS was created to facilitate a name to all IP addresses.

When you type an URL for example: https://www.holbertonschool.com into your web browser, what you are doing is submitting a request for this specific website. Step 1.) The browser checks if this website has been accessed previously. Step 2.) The browser and the browser’s OS look for the webpage in their cached data. Step 3.) The browser asks your internet service provider to perform a DNS lookup, this only happens if the site is not found. The domain names hold records that control information in the internet.  

Types of records are: 
  • A record
  • Cname records
  • MX records
  • TXT records

TCP/IP

All devices that are connected to the internet posses a unique number that identifies them called IP Address. An IP address is a 32 (IPv4) or 128-bit(IPv6) number that is written in dotted decimal notation. They are very important for network communication and they are assigned by network authorities. TCP Stands for Translation Control Protocol. 

When the server finds the requested data when trying to access web page content, it sends it back to you. This happens through the TCP/IP protocol, that establish a connection between both devices using their IP addresses. Through this reliable connection, the requested data is broken down into packets and it reassembles as it travels through the network back to its destination point.

Firewall

This is a device that burns down any type of IPs trying to access your web server. Jokes aside, this is a very important service when you access a web page. It prevents unauthorized programs or malware from going through the active connection you have with the web page you are viewing. It also protects your connection to any web server by supervising incoming and outgoing traffic. If i were to access the URL (https://www.holbertonschool.com) through an unauthorized port the firewall will prevent me from entering and display an error in connection.


HTTPS/SSL

The actual request being made by the browser once you type the URL is called an HTTPS request. HTTPS stands for HyperText Transfer Protocol Secure, in other words, it is the secure version of the HTTP protocol. This protocol is in charge of managing how requests and messages are being transmitted and formatted through the web. Once your browser makes a HTTP request, the server receives the request and proceeds to fetch the requested data. In the end,  the server sends back an HTTP response back to the web browser.

Load-Balancer

Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool. Its main role is to efficiently redirect web traffic to multiple servers and to do this it relies on several algorithms:

  • Roundrobin: web traffic is redirected evenly between servers.
  • Least Connection: web traffic is redirected to the server with the least amount of requests.
  • IP Hash: web traffic is redirected depending on the client’s IP address.

Webserver

A web server is a software that takes care of delivering the content of web pages to clients through the HTTP/ HTTPS protocol. The incoming traffic is redirected by the load-balancer, then, the web server receives the path to the requested by the HTML files through the HTTP request. Finally,  the web server looks for those files in the server’s codebase and once it fetches those files it's ready to make the HTTP response. Nginx and Apache are some examples of webservers.

Database

It is a structured set of data held in a computer, especially one that is accessible in various ways. Information requested by a server can be held in a database.