What happens when you type an URL in your browser and press Enter?
By: Hadir Jenni
Tags: Websearch, Nginx, Website, System Engineering, Web

What happens when you type an URL in your browser and press Enter? Hadir Jenni Apr 25·3 min read

We can admit that all people around the world use the internet all the time for any sorts of purposes since we’re living in a technological area. Most of time we type something in our browser and op we get the response in seconds, is it magic ? Of course not ! So what happens behind the scene when you browse to a website??

The client server model

Before we dive into the details of the web, we need to understand the client server model so: The client-server model describes how a server provides resources and services to one or more clients. Examples of servers include web servers, mail servers, and file servers. Each of these servers provide resources to client devices, such as desktop computers, laptops, tablets, and smartphones and here’s a diagram to better understand:

Clients are the web user’s(Computer connected to the WIFI, a phone connected to the mobile network)

Servers are computers that store webpages, sites, or apps

In addition to the client and the server, we also need:

Internet connection: That allow us to send and receive data on the web

Web-server: (like nginx) implement the HTTP protocol along with some other functions, that enable web browsers to connect, request and receive web data

TCP/IP: Stands for Transmission Control Protocol and Internet Protocol, are the communication protocols that define how data travel the internet.

DNS: Domain Name Servers, when you type a web address in the browser, the browser looks at the DNS to find the real address of the website so he can send a HTTPS messages to the right place.

HTTPS: Hypertext Transfer Protocol Secure is a secure version of HTTP that define a language for clients and servers to speak to each other

Firewall: Is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules

Load-balancer: Is a device that acts as a reverse proxy and distributes network or application traffic across a number of servers. Load balancers are used to increase capacity (concurrent users) and reliability of applications.

are used to increase capacity (concurrent users) and reliability of applications. Database: Database servers are servers dedicated to storing and organizing data. When a user signs in to Holberton Intranet, a query will be sent to one of Holberton’s database servers asking “USERNAME” is an actual user, if so, it will check the password they entered against the password in the database and then act accordingly by giving them access or denying them access to their account.

Component files:

Code files: like HTML, CSS and JS

Asset: a collective name for all the other stuff like images, music ..

So what happens, exactly when you type https://www.holbertonschool.com in your browser and press Enter?

The browser goes to the DNS server, and finds the real address of the server that the website lives on. The browser sends an HTTP request message to the server, asking it to send a copy of the website to the client, this message and all data sent between client and server are sent across the internet using TCP/IP. If the server approves the client’s request, the server sends the client a “200 OK” message, and then start sending the website’s files to the browser as a series of data packets The browser assembles the data packets into a complete web page and displays it to you.

And that’s how the magic happens!