DEV Community

Cover image for What happens when you enter a URL in your browser?
Mohamed Amine Fh
Mohamed Amine Fh

Posted on • Edited on

What happens when you enter a URL in your browser?

Have you ever wondered what happens when you open your browser(Chrome, Firefox, ...) type your preferred website, and hit Enter?

What is going on behind the scenes?

In this blog, we'll cover what happens there.

before we get started we need to understand a few things IP addresses, servers, DNS.

What is an IP address?

Ip address

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the Internet or local network.

It is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be 192.158.1.38. Each number in the set can range from 0 to 255. So, the full IP addressing range goes from 0.0.0.0 to 255.255.255.255

-So every computer connected to the internet is assigned to a unique IP address-.

What is a server?

data center servers

A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network.

In simple terms, a server is a computer (laptop, desktop, smartwatch, smartphone, ...) that can communicate with other computers.
In most cases nowadays we refer to servers as those that exist in the cloud provided by giant data center companies (Google, Facebook, Amazon, ...).

What is a DNS?

The Domain Name System (DNS) is a special server that works as a phonebook of the Internet. Humans access information online through domain names, like google.com. DNS translates domain names to IP addresses.
DNS server

Each device connected to the Internet has a unique IP address (as we mentioned above) which other computers use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 12.45.56.67.

so think of DNS as a translator from human-readable domain names to computer-readable IP addresses.

So after we cover the above concepts it should be easier for us to understand the rest.

TCP/IP connection

When you type https://www.google.com in your browser, your browser will go to the DNS, get the IP address associated with that URL, and start a TCP/IP connection with the server that has that IP address.

Web servers

A web server is a computer that runs websites. It’s a computer program(must be installed) that distributes web pages. The basic objective of the web server is to store, process, and deliver web pages to users(web browsers). This intercommunication is done using Hypertext Transfer Protocol (HTTP).

examples of web servers are Nginx, Apache

HTTP(s) connection

websites are transferred through the HTTP protocol, the secure version of that protocol is the HTTPS protocol which tells the browser to make a secure connection with the server using the Transport Layer Security (TLS).

With TLS data exchanged between the browser and the server (password, credit card) is encrypted.

Now that the browser has a connection (TCP/IP) to the server it will follow the HTTP(s) protocol,
so It will send an HTTP request to the server requesting the necessary static files at that location (HTML, CSS, JS, Images, ...).

The server could contain an application server that delivers dynamic content instead of static one based on database data like user profiles or real-time updates like chat messages.

simple web infrastructure

If the request is understood by the server, the server will send back the files to the browser.

Web server VS App server

Web server VS App server

  • A web server delivers static web content—e.g., HTML pages, files, images, video—primarily in response to hypertext transfer protocol (HTTP) requests from a web browser.

  • An application server typically can deliver web content too, but its primary job is to enable interaction between end-user clients and server-side application code—the code representing what is often called business logic—to generate and deliver dynamic content, such as transaction results, decision support, or real-time analytics

Databases

A database is information that is set up for easy access, management and updating. Computer databases typically store aggregations of data records or files that contain information, such as sales transactions, customer data, financials and product information.

Databases are used for storing, maintaining and accessing any sort of data. They collect information on people, places or things. That information is gathered in one place so that it can be observed and analyzed. Databases can be thought of as an organized collection of information.

Presenting the content by the browser

After the server sends back the files, the browser understands how to present the content and starts presenting the content to the user.

Renders content in browser


That's a pretty straightforward/classic scenario when you type a URL in the browser. nowadays many threats are threatening the internet, Cyber attacks have been rated the fifth top-rated risk in 2020 and become the new norm across public and private sectors.

cyber attack


Therefore the connection to the internet nowadays consists of new layers of security including but not limited to Load-balancer, Firewall.

Load balancer

Load balancer

A load balancer acts as the “traffic cop”👮 sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance.

Firewall

firewall

A firewall is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.


You made it to the end 👏👏. Now you have a clear idea of what will happen next time when you type a URL and hit Enter


Thanks for reading

Top comments (0)