DEV Community

Cover image for What Really Happens After You Click "Login"?
Arashad Dodhiya
Arashad Dodhiya

Posted on

What Really Happens After You Click "Login"?

Every day, billions of people click a button that looks something like this:

<button>Login</button>
Enter fullscreen mode Exit fullscreen mode

It feels instant.

You enter your username, type your password, click Login, and suddenly you're inside your account.

Simple, right?

Not exactly.

That single click triggers a journey through multiple systems, servers, security layers, and databases before you ever see your dashboard.

Most users never think about what happens behind the scenes.

Cybersecurity professionals do.

Let's follow the journey of a login request and see what really happens after you click that button.


The Login Journey

A typical modern web application might process your login request like this:

Browser
   ↓
CDN
   ↓
WAF
   ↓
Load Balancer
   ↓
Web Server
   ↓
Application
   ↓
Database
Enter fullscreen mode Exit fullscreen mode

It may look complicated, but each layer has a specific job.

Think of it like visiting a highly secure office building.

Before reaching the employee you're meeting, you'll pass through reception desks, security checkpoints, elevators, and access controls.

Web applications work in a very similar way.


Step 1: Your Browser Sends the Request

Everything starts with your browser.

You enter:

Username: john@example.com
Password: ********
Enter fullscreen mode Exit fullscreen mode

and click Login.

Your browser packages that information into an HTTP request and sends it toward the website.

Something like:

POST /login
Enter fullscreen mode Exit fullscreen mode

At this point, your browser doesn't know whether the password is correct.

It simply delivers the information.

Think of the browser as a courier carrying a sealed envelope.


Step 2: The CDN Speeds Things Up

Before reaching the actual website, your request may pass through a CDN (Content Delivery Network).

A CDN is a network of servers distributed around the world.

Instead of every user connecting directly to a server in another country, the CDN helps deliver content from a location closer to them.

This makes websites faster and reduces load on the main infrastructure.

For static content such as images, CSS files, and JavaScript files, the CDN often serves them directly.

For login requests, however, the request usually continues deeper into the application's infrastructure.


Step 3: The WAF Checks for Suspicious Activity

Next comes the Web Application Firewall (WAF).

Think of it as a security guard standing at the entrance.

Its job is to inspect incoming requests and identify potentially malicious traffic.

For example, if someone tries to submit a login request containing suspicious payloads or attack patterns, the WAF may block the request before it reaches the application.

Most users never notice it's there.

Attackers definitely do.


Step 4: The Load Balancer Directs Traffic

Popular websites receive thousands or even millions of requests every minute.

One server cannot handle that amount of traffic alone.

That's where a load balancer comes in.

Imagine a traffic officer directing vehicles onto different roads.

The load balancer distributes incoming requests across multiple servers.

User 1 → Server A
User 2 → Server B
User 3 → Server C
Enter fullscreen mode Exit fullscreen mode

This prevents any single server from becoming overwhelmed.


Step 5: The Web Server Receives the Request

Now the request reaches the web server.

Its job is to receive HTTP requests and determine where they should go next.

The web server understands requests like:

GET /profile

POST /login
Enter fullscreen mode Exit fullscreen mode

and passes them to the appropriate application logic.

Think of the web server as a receptionist.

It doesn't make business decisions.

It simply knows where to send visitors.


Step 6: The Application Processes Your Login

This is where the real work begins.

The application server contains the logic that powers the website.

It asks questions such as:

  • Does this user exist?
  • Is the password correct?
  • Is the account locked?
  • Is multi-factor authentication enabled?

The application takes your submitted credentials and prepares to verify them.

This is the layer where much of the application's functionality lives.

It's also where many security vulnerabilities can exist if developers make mistakes.


Step 7: The Database Is Consulted

The application now needs to verify your identity.

To do that, it contacts the database.

The database stores information such as:

  • User accounts
  • Password hashes
  • Orders
  • Messages
  • Settings

The application might ask:

SELECT * FROM users
WHERE email='john@example.com'
Enter fullscreen mode Exit fullscreen mode

The database returns the matching user record.

The application then compares the stored password hash with the password you entered.

If everything matches, you're authenticated.


Step 8: Access Granted

Once the application confirms your identity, it creates a session or authentication token.

This token acts like a temporary access pass.

Instead of asking for your password on every page, the website uses this token to recognize you.

The application sends a success response back through the same path:

Database
   ↑
Application
   ↑
Web Server
   ↑
Load Balancer
   ↑
WAF
   ↑
CDN
   ↑
Browser
Enter fullscreen mode Exit fullscreen mode

A few milliseconds later, your dashboard appears.

From your perspective, it feels instant.

Behind the scenes, an entire chain of systems just worked together.


Why Cybersecurity Professionals Care

Most people see a login page.

Security researchers see an architecture.

When a researcher examines a web application, they don't just think about usernames and passwords.

They ask questions like:

  • Is the login protected by a WAF?
  • How are sessions managed?
  • Is the backend validating inputs correctly?
  • Can authentication be bypassed?
  • Are APIs exposing sensitive data?
  • Is the database securely queried?

Understanding the architecture helps security professionals understand where weaknesses might exist.

You can't effectively secure a system if you don't understand how it works.


Final Thoughts

The next time you click Login, remember that you're not simply sending a username and password to a website.

Your request may travel through security systems, traffic distribution layers, application servers, and databases before a response is returned.

What looks like a simple button click is actually a carefully orchestrated process involving multiple technologies working together.

For users, it's convenience.

For engineers, it's architecture.

For cybersecurity professionals, it's the beginning of understanding how modern applications really work.

Top comments (0)