Reverse proxies and app services
Quick answer
A reverse proxy receives a client request and forwards selected requests to an upstream application. It separates public entry points from internal application listeners.
The proxy and upstream application are separate failure points. A proxy accepting a connection does not guarantee that the upstream is healthy. Compare a private upstream health check with the proxied response and examine both logs without exposing credentials.
Prepare the practice environment
Run python3 lab-fixtures/servers/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Only local loopback services and private files are used. Optional examples require an authorized snapshot VM. Never expose a lab listener publicly or modify system services. Review the lab guide.
How it works
A typical request reaches the proxy, matches a route, connects to the upstream, and returns the upstream response. Static files can be served directly. Bind a same-host backend to loopback or a Unix socket when appropriate; a remote backend needs an authorized private path. proxy_pass specifies an upstream; path rewriting depends on its URI and location syntax. Timeouts prevent indefinite waits. A 502 can indicate failure to communicate with an upstream, while a 504 indicates a gateway timeout; inspect proxy and application logs before changing configuration. Forwarded headers must be trusted only from controlled proxies. The fixture uses a fictional backend port for offline validation, and a synthetic route table for reasoning; no real Nginx proxy connection is required.
Try the examples
The modeled route points to a loopback upstream. This does not prove a listener exists.
Expected stdout:
127.0.0.1:19081The sample keeps the original request URI because proxy_pass has no URI component here. Review path behavior when adding a URI.
Expected stdout:
proxy_pass http://127.0.0.1:19081;Configuration syntax is checked using a private prefix. No upstream or proxy service is started.
Expected stdout:
proxy configuration validCommon mistakes
Do not make a backend public just to fix a proxy error. Do not accept client-supplied forwarding headers as proof of identity.
Practice
Explain the request flow for /api/items versus /index.html using the route model. For a hypothetical 502, list a listener check, an upstream health check and a log check before a configuration change.
Related references
Study: nginx, systemctl. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reverse proxies and app services — Knowledge Check
Apply hosting and deployment concepts to synthetic fixtures and VM-only scenarios.
Where does a reverse proxy forward a request?
Why bind a same-host backend to loopback?
What can a 502 suggest?
Does offline proxy syntax validation test upstream health?