Behind the Scenes: What Really Happens When You Type a URL in Your Browser
Published: 2024-02-10 09:40:32


Ever wonder what happens behind the scenes when you type a URL like “google.com” into your browser? It’s like entering a hidden world where countless machines work together to bring you the information you seek. In this article, I`ll embark on a journey to explore this fascinating process, from deciphering domain names to navigating firewalls and finally retrieving data from massive databases get ready to discover the magic behind your everyday internet searches!
 

**The Secret Language: HTTP**

Imagine one day you asked me how are you and I answered with two 🧅🧅onions ! 🫥🫥 ? but if we had agreed before that if i showed you two onions it means I am fine so we have agreed on a protocol so you now will understand me

Similarly, web browsers and servers don't just exchange random data. They use a specialized language called HTTP (Hypertext Transfer Protocol), which defines how information is formatted and exchanged between them.

Think of HTTP as a set of rules that ensure both sides understand each other. When you type a web address, your browser sends an HTTP request to the server using this language, specifying what kind of information it wants (e.g., displaying a web page, downloading a file). The server responds with an HTTP response, usually containing the requested information.

**Finding the Right Address:**
Just like we use phone numbers to contact specific people, websites have unique addresses called IP addresses. But wouldn't it be cumbersome to memorize an endless string of numbers for every website? That's where the Domain Name System (DNS) comes in.
Think of DNS as the internet's phonebook. When you type "https://www.google.com/" in your browser, it asks the DNS for the corresponding IP address, similar to looking up a name in a phonebook. Once it has the correct address, your browser can connect to the right server.
 DNS server (a computer server that contains a database of public IP addresses and their associated hostnames.)

**The Highway of Information:**
With the address in hand, it's time to send the HTTP request how we will get to google server 
Imagine you live at California and google server is in Boston we need to a road to go there and get what we want and their may be different roads which one we should choose
this is TCP/IP protocol turn TCP/IP protocols are responsible for routing and sending data between your browser and your server think of this Like a route and a car TCP act like a car it send the data by divided it into packet to the right address that has same IP address

**Security Matters:**
Sharing secrets online needs protection! That's why some websites use HTTPS (Hypertext Transfer Protocol Secure). It's like having a safe tunnel for your information, encrypting it and keeping it away from prying eyes.

when the TCP/IP connection has been done. the browser proceeds to communicate with the server using a secure protocol, HyperText Transfer Protocol Secure (HTTPS) This protocol defines different types of requests (eg; GET, POST and PUT) and responses that are secured by a standard security protocol called Secure Sockets Layer (SSL) which encrypts and decrypts the data from the client to the server. but wait how can google handle all these requests think about how many users are opening google.com at this time? it will be large number right? that’s why google not have one server but thousands of them. Cool right? but where does your request go? to which server?. The one who knows the answer is Load-balancer.

**Scaling Up: Load Balancers Distribute the Workload**

Think of a load balancer as a traffic controller. It acts as a middleman, intelligently distributing incoming requests among multiple servers behind the scenes. This ensures that users experience fast and seamless browsing, even with high traffic.

There are two types of Load-balancers which are software and hardware
Software Load Balancers
The following are few examples of software load balancers:

HAProxy — A TCP load balancer.
NGINX — A http load balancer with SSL termination support. (install Nginx on Linux)

by using scheduling algorithms. load balancer will choose the appropriate server to handle your request

Hardware Load Balancers
Load balancing hardwares are often referred as specialized routers or switches which are deployed in between the servers and the client. It can also be a dedicated system in between the the client and the server to balance the load.

but this is not the only use of load balancer as it check regularly about the health of each server so when server shut down the requests divided on the other too 🙂

load balancer is a life saver right ?
but what if the http request come from suspicious source that is where the Firewall gets in handy

**Watchdogs on the Web: Firewalls Protect Against Malicious Requests**

Imagine a city with open gates, welcoming everyone. While great for accessibility, it could also be vulnerable to unwanted visitors. On the internet, firewalls play a similar role, acting as gatekeepers for web servers.
When a request arrives, even if it originates from a seemingly valid IP address, the firewall steps in. Imagine the Great Wall of China, diligently examining each traveler before granting entry. The firewall analyzes the request based on predefined rules, checking for suspicious patterns or indicators of harm.
If the request appears malicious or comes from a known bad actor, the firewall blocks it. Think of it as raising the drawbridge and sounding the alarm. Only safe and authorized requests are allowed to pass through.

But wait, there's more! Behind the web server might lurk an application server, responsible for dynamic content (think interactive features or login portals). This server works closely with a database to power your favorite web applications.
Remember, security is a layered approach. Firewalls are crucial first lines of defense, but staying vigilant and keeping software updated are equally important. With these steps in place, you can enjoy the vastness of the internet with peace of mind


**The Power Player Behind Dynamic Websites: Unveiling Application Servers and DBMS**

Think of the application server as the heart of the kitchen, working tirelessly behind the scenes to create dynamic content tailored to your requests. It performs all sorts of magic, such as:
Handling complex user interactions: Think logging in, posting comments, or sending messages.
Processing data in real-time: Imagine refreshing a newsfeed or seeing personalized recommendations.
Generating dynamic pages: Customized content based on your preferences or location.
But where does the application server get all its ingredients? Enter the Database Management System (DBMS), often abbreviated as DBMS. Imagine it as the restaurant's pantry, meticulously storing and organizing vast amounts of data—recipes, customer information, order history, and much more.
The DBMS plays a crucial role:
Storing and managing data efficiently: From simple login details to complex product catalogs.
Providing secure access: Ensuring only authorized users can access specific data.
Optimizing data retrieval: Quickly finding the information you need.

**Let's recap the journey of a user request:**
User enters a URL.
DNS translates the domain name to an IP address.
TCP/IP connection is established.
Firewall analyzes the request.
If safe, the request reaches the load balancer.
Load balancer distributes the request to a web server.
And that is it for today, thank you for reading!😀