Skip to content
BENIBIX Learn

Reverse Proxy

Infrastructure🌍 Web Serving & NginxProxies and Caches

Also known as Reverse Proxy Server

A server in front of your apps. It takes each request and passes it on.

Think of it like

It is like the front desk at an office. Visitors talk to the desk, and the desk passes notes in.

Example

Lucy's shop app listens only on localhost port 3000. Nginx takes HTTPS requests on port 443 and passes them to the app.

Why it matters

It gives many apps one safe front door. TLS, logs and limits are set up in one place.

Definition

A reverse proxy is a server that sits in front of your app servers and takes every request first. It passes each one on to a server behind it and sends the answer back. Visitors never talk to the app servers directly. On the way, it can handle TLS, cache answers, block bad traffic and share the load.

Example code

nginx
location / {
    proxy_pass http://127.0.0.1:3000;
}
This one line hands every request on to the app that listens on port 3000.
The reverse proxy sits at the origin. It takes each request and passes it to an app server behind it.

Common mistake

Mixing it up with a forward proxy. A forward proxy works for users going out. A reverse proxy works for servers taking requests in.

Key takeaways

  1. 1
    In front of servers. Takes every request first.
  2. 2
    Hides the back. Visitors never reach the app directly.
  3. 3
    Does extra jobs. TLS, caching and limits.

Compare