Understanding Nginx Forward and Reverse Proxy: A Complete Visual Guide

This article explains how Nginx functions as both a forward proxy that represents clients to reach external servers and a reverse proxy that hides backend servers while handling client requests, illustrated with diagrams and a step‑by‑step flow diagram.

Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Understanding Nginx Forward and Reverse Proxy: A Complete Visual Guide

Nginx Forward Proxy

Nginx can act as a forward proxy, which means it represents the client and forwards requests to the target server on the client’s behalf.

When a client needs to access a site such as Google that cannot be reached directly, it sends the request to the configured forward proxy. The proxy then bypasses network restrictions and accesses the target site.

Nginx forward and reverse proxy diagram
Nginx forward and reverse proxy diagram

Nginx Reverse Proxy

In contrast, a reverse proxy represents the server side: it receives client requests, forwards them to backend servers, and returns the responses to the client without exposing the backend details.

The client only interacts with the proxy and is unaware of which backend server actually processes the request.

Nginx reverse proxy diagram
Nginx reverse proxy diagram

Key differences:

Forward proxy proxies the client, representing the client to external servers.

Reverse proxy proxies the server, representing the server to clients.

Reverse Proxy Flow

The typical reverse‑proxy workflow is:

Nginx reverse proxy flow diagram
Nginx reverse proxy flow diagram
<ol>
<li>Client ──► Nginx (reverse proxy) ──► Backend server</li>
<li>↑   ↓</li>
<li>Response ◄───────────────────────</li>
</ol>

Steps:

The client sends a request to Nginx; the request’s destination is Nginx itself.

Nginx receives the request, matches the location and proxy_pass directives, and decides which backend server to forward to.

Nginx forwards the request to the chosen backend server, acting as a client toward that server.

The backend processes the request and returns a response; Nginx passes the response back to the original client, optionally applying transformations.

The core of Nginx reverse proxy is to forward client requests to backend services while hiding backend details, providing security controls and load‑balancing capabilities.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend DevelopmentNginxreverse proxyWeb serverforward proxy
Mike Chen's Internet Architecture
Written by

Mike Chen's Internet Architecture

Over ten years of BAT architecture experience, shared generously!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.