Introduction

Ever wondered what happens when a user makes a request to your web application? How does the data travel from the frontend to the backend and return a response?

In this blog, we’ll break it down step by step in the simplest way possible, using a real-world web app architecture built with:

  • React (Frontend) served via Nginx
  • Django (Backend) running with Gunicorn
  • AWS Infrastructure (ALB, RDS, S3, EC2, etc.)
  • Docker for containerized deployment

By the end of this blog, you’ll have a clear understanding of how requests flow through a modern web application. Let's get started! 🚀

🔍 Step 1: User Makes a Request

A user opens their browser and types:

https://example.com/login

Pressing Enter sends an HTTP request that starts a journey through multiple layers of the system.

📌 At this point, the request needs to be routed to the right place.

🌍 Step 2: Request Reaches AWS Application Load Balancer (ALB)

AWS Application Load Balancer (ALB) is the first stop for all incoming requests. It acts as a traffic controller and ensures:

✅ Load Balancing: Distributes traffic across multiple backend instances.
✅ High Availability: Redirects traffic if a server goes down.
✅ Security: Works with AWS security groups & firewall rules.

The ALB forwards the request to the Firewall Tracker Process before it reaches Nginx.

🔒 Step 3: Firewall Tracker Process - Security Checkpoint

Before allowing the request to proceed, our Firewall Tracker Process checks:

🔍 Suspicious IPs or unusual behavior (e.g., too many requests from one user)
🚫 Blocks unauthorized access (DDoS protection, bot prevention)
✅ Passes safe requests forward

Once cleared, the request moves forward to Nginx.

🚀 Step 4: Nginx - Reverse Proxy & Static File Server

Nginx acts as a reverse proxy inside a Docker container. It performs multiple tasks:

1️⃣ Proxies API requests to Gunicorn (for dynamic content)
2️⃣ Serves static files like CSS, JavaScript, and images
3️⃣ Performs load balancing if multiple backend servers exist

Nginx forwards the request to Gunicorn.

⚙️ Step 5: Gunicorn - The WSGI Server

Gunicorn is a WSGI server that manages requests before they reach Django.

✅ Manages multiple workers to handle multiple requests at the same time.
✅ Interfaces with Django to process the request.

Gunicorn then hands over the request to Django.

🛠️ Step 6: Django - The Brain of the Backend

Now that the request has reached Django, here’s what happens:

📌 Django URL Router decides which view function should handle the request.
📌 Middleware Processing checks authentication, permissions, and session data.
📌 Django ORM (Database Layer) queries AWS RDS (PostgreSQL) if needed.
📌 Business Logic Executes and processes the data.

Once done, Django returns a response to Gunicorn.

📡 Step 7: The Response Travels Back

The response now follows the same path back:

1️⃣ Django processes the request and sends a response.
2️⃣ Gunicorn receives it and passes it to Nginx.
3️⃣ Nginx sends it back through the AWS ALB.
4️⃣ The User finally sees the response on their screen!

🐳 Bonus: Why We Use Docker

We use Docker to containerize:

  • Nginx (Reverse Proxy & Static File Server)
  • Gunicorn (WSGI Server)
  • Django (Backend)

Docker helps us with:

✅ Portability – Runs the same way on dev, staging, and production.
✅ Scalability – Spin up more containers if traffic increases.
✅ Consistency – Ensures a stable environment across deployments.

🎯 Conclusion

Understanding how a request flows through a web application is crucial for debugging and optimization. Let’s summarize:

📌 User sends a request → AWS ALB → Firewall Tracker → Nginx → Gunicorn → Django → Database
📌 Django processes the request and sends a response back through the same path.
📌 Docker helps keep everything stable, scalable, and portable.

I hope this guide made things easier for you! 🚀 If you have any questions, drop a comment below. Happy coding! 💻🔥

Checkout this video for an in depth explanation - Journey of a Web Request From URL to response

Thank you for reading! If you have any questions or feedback about this article, please don't hesitate to leave a comment. I'm always looking to improve and would love to hear from you.

Also, if you enjoyed this content and would like to stay updated on future posts, feel free to connect with me on LinkedIn or X or check out my Github profile. I'll be sharing more tips and tricks on Django and other technologies, so don't miss out!

If you find my content valuable and would like to support me, you can also buy me a coffee. Your support helps me continue creating helpful and insightful content. Thank you!

Author Of article : Aditya Mathur Read full article