- Load balancing with health checks and algorithms
- Reverse proxying with TLS termination and buffering
- Forward proxy functionality and module requirements
- Proxy caching and microcaching for high throughput
Load balancing
A load balancer is like a restaurant manager who assigns incoming orders to multiple waiters so no single waiter becomes overwhelmed. NGINX can distribute client requests across multiple backend servers to improve availability and scale. Typical NGINX load balancing setup uses anupstream block that lists backend servers and a frontend server block that proxies requests to that upstream. Common balancing methods include round-robin, least_conn, and ip_hash.
Example NGINX configuration (round-robin):
max_fails and fail_timeout:

References:
Reverse proxy
A reverse proxy sits in front of your backend servers and forwards incoming client requests. Think of it as a postal clerk who receives a package and decides which courier delivers it — the clerk is the reverse proxy; the courier is the backend server. Benefits of using NGINX as a reverse proxy:- Central TLS termination (offloads HTTPS from backends)
- Request buffering and compression
- Caching of responses
- Access control and rate limiting
- Serving static content directly from the proxy

Difference between a reverse proxy and a load balancer: a load balancer’s primary job is to distribute traffic across multiple backends to prevent overload; a reverse proxy’s primary role is to act as the intermediary that forwards client requests to backend servers. In practice, NGINX can be configured to perform both roles simultaneously.
Forward proxy
A forward proxy sits between internal clients and the Internet, forwarding outgoing client requests to remote servers. Use cases include content filtering, access control, caching outbound responses, and client anonymization (hiding client IPs). Note about NGINX forward proxy support:- Default NGINX is primarily designed for reverse proxying.
- Supporting HTTPS forward proxying (CONNECT tunneling) typically requires additional modules such as
ngx_http_proxy_connect_moduleor third-party solutions.
NGINX does not natively support full forward-proxy CONNECT handling in the open-source distribution. Implementing a forward proxy for HTTPS usually requires third‑party modules or custom builds. Evaluate security implications carefully before exposing a forward proxy.
Caching
Caching is like brewing coffee in advance and keeping it ready: repeated requests are served faster because the proxy returns a stored response instead of contacting the backend. NGINX proxy cache reduces backend load and latency. Important caching controls include cache keys, TTLs, cache zones, and purge policies. Microcaching (very short TTLs, e.g., 1–5 seconds) can significantly increase throughput for high-traffic dynamic sites. Example proxy cache configuration:- Use
proxy_cache_keyto avoid cache collisions - Respect
Cache-ControlandExpiresheaders from backends where appropriate - Use
proxy_cache_bypassandproxy_no_cachefor authenticated or dynamic content - Implement purge mechanisms if you need immediate invalidation
Use case summary
Further reading and references:
Later in this lesson series we will implement hands-on examples for load balancing, reverse proxying, and caching so you can test these patterns in a lab environment.