Tools & Infrastructure

What Is a Reverse Proxy and What Does It Do?

How a reverse proxy sits in front of web servers to handle traffic, improve speed, and keep things secure.

Scroll to start

The Gatekeeper in Front of Every Website

Imagine you're visiting a big website like Netflix. You type the address, hit Enter, and the page loads. What you might not know is that your request didn't go straight to Netflix's computers — it stopped at a reverse proxy first.

A reverse proxy is a server that sits between you and the internet. When you try to visit a website, your request goes to the reverse proxy first. The proxy then decides where to send it. The actual website server never sees your device directly — it only ever sees the reverse proxy.

Think of it like a hotel receptionist. When you walk into a hotel, you don't walk straight into someone's room. You stop at the front desk, and the receptionist directs you from there. The reverse proxy is that receptionist for the internet.

Speed, Security, and Stability

Reverse proxies do three important jobs for websites:

Security: The real website servers stay hidden. Hackers can't attack them directly because they can only see the reverse proxy, not the servers behind it. It's like having a bulletproof vest in front of your actual servers.

Speed (Caching): A reverse proxy can save copies of pages and files that don't change often. When thousands of people visit the same page, the proxy serves the saved copy instead of bothering the actual server every time. This makes websites load much faster.

Stability (Load Balancing): When millions of people try to watch a new show on a streaming service at once, a reverse proxy spreads that traffic across many different servers. No single server gets overwhelmed and crashes.

💡 Key Insight

Without reverse proxies, big websites would crash constantly. Every time a site goes viral — a new product launch, a live event — the reverse proxy absorbs the traffic spike so the real servers never feel it.

The Request Journey

Here's what happens step by step when you visit a website that uses a reverse proxy:

A Request Goes Through a Reverse Proxy
🖥️
Your Browser
You type a URL and hit Enter
🔀
Reverse Proxy
Receives the request, decides where to send it
🗄️
Cache Check
Is this page saved already?
🖥️
Real Server
Delivers the page (if not cached)
Back to You
Response sent through the proxy to you
each request follows this path

The proxy can send your request to many different servers at once. If one server is busy, it picks a quieter one. This is called load balancing, and it's how sites handle sudden spikes in traffic.

A Simple Nginx Reverse Proxy

Here's a real example of how to set up Nginx as a reverse proxy. If you have a Node.js app running on port 3000, you can use Nginx to receive traffic on port 80 (the normal web port) and forward it to your app.

nginx.conf
# This nginx config makes it act as a reverse proxy
server {
  listen 80;
  server_name mysite.com;

  # Everything sent here gets forwarded to port 3000
  location / {
    proxy_pass http://localhost:3000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
  }
}

Now when someone visits mysite.com, Nginx receives the request and sends it to your Node.js app running on port 3000. The outside world never knows port 3000 exists — they only see port 80. Your app is hidden safely behind Nginx.

Knowledge Check

Test what you learned with this quick quiz.

Quick Quiz — 3 Questions

Question 1
Where does a reverse proxy sit in relation to users and the real web server?
Question 2
What is caching in the context of a reverse proxy?
Question 3
Why do big websites use reverse proxies for security?
🏆

You crushed it!

Perfect score on this module.