envoy-guide
Module 1 · Foundations·8 min·beginner

What is a proxy?

Tell forward, reverse, and sidecar proxies apart.

The one-sentence definition

A proxy is a server that sits between two parties and forwards traffic on their behalf. Whoever makes the request sees only the proxy. Whoever receives the request sees only the proxy. That layer in the middle is where you can do useful things: cache, log, retry, encrypt, route, block, count.

Three flavors matter:

  • Forward proxy — sits in front of clients, talking to the open internet for them. Think: corporate web filter, your old uni library proxy.
  • Reverse proxy — sits in front of servers, taking requests from the outside world and forwarding to backends. Think: nginx in front of your Node.js app.
  • Sidecar proxy — a reverse proxy deployed next to a single instance of one service. The app talks to localhost; the sidecar handles everything about the network.

Envoy is almost always used as a reverse proxy, often as a sidecar.

Mental model

A normal reverse proxy is one bouncer at the front door of a building. A sidecar proxy is a personal bodyguard for every employee. Same job, very different scale.

Why "in the middle" is so useful

The moment two services talk through a proxy, you stop having to bake networking concerns into either one of them. Want HTTPS? Terminate it at the proxy. Want retries? Configure them at the proxy. Want metrics? The proxy already has them. Want to ship a new version to 1% of users? Tell the proxy to do it.

This is the trick that lets a microservice fleet stay sane: move the boring network logic out of the apps, into a uniform layer that every team gets for free.

A concrete picture

Without a proxy — the app handles everything:

With a reverse proxy — Envoy absorbs the boring parts:

With a sidecar — one Envoy per app instance, sharing localhost:

Real-world example · Lyft
Problem
By 2015 Lyft had a polyglot fleet — Python, Go, PHP — and every team kept reinventing retries, timeouts, TLS, and metrics in their own language. Outages got blamed on "the network," but the real problem was that no two services handled it the same way.
Envoy solution
They put a sidecar process next to every service. Apps talked to localhost; the sidecar (the original Envoy) did all the networking. Within months every service got the same retry policy, the same TLS, the same dashboards — without changing app code in any language.

This is exactly the model Istio later popularized for the rest of the industry. The "service mesh" pattern is just "put a sidecar reverse proxy next to every service, and configure them all the same way."

Hands-on: see a reverse proxy with your own eyes

You don't even need Envoy yet. Any reverse proxy will do — here's the smallest demo using nginx, just so the concept clicks. We'll use Docker so there's nothing to install.

Hands-on · 2-minute reverse proxy

Create a file called nginx.conf in an empty folder:

Text
events {}
http {
  server {
    listen 8080;
    location / {
      proxy_pass http://httpbin.org/;
      proxy_set_header Host httpbin.org;
    }
  }
}

Run nginx in front of httpbin.org:

Shell
docker run --rm -p 8080:8080 \
  -v "$PWD/nginx.conf:/etc/nginx/nginx.conf:ro" \
  nginx

In another terminal:

Shell
curl -s localhost:8080/get | head -20

You're hitting your own machine on port 8080, but the response comes from httpbin.org. You just built a reverse proxy. Stop the container with Ctrl+C when you're done.

Common pitfall

"Forward" vs "reverse" trips up almost everyone. The trick: ask who the proxy is hiding. A forward proxy hides the client from the server. A reverse proxy hides the server from the client. Envoy hides servers, so it's a reverse proxy.

What this means for the rest of the course

For the next 15 lessons, when you see Envoy doing something — load balancing, TLS, retries, canary releases — remember it's "just" a reverse proxy with very good ergonomics for microservices. The reason it gets its own course is that the configuration model (listeners, filters, clusters, routes, xDS) is rich enough that learning it pays off many times over.

Quick check

A 'sidecar proxy' is best described as…

Practical task
Finish the quick check and tick off the task to unlock.
Quick checkTasks 0/4