Interview Prep/Networking/Load Balancing, Proxies & nginx in Production

How do you make an nginx upstream resilient to a failing backend?

IntermediateProductionLoad Balancing, Proxies & nginx in Production
Answer

Use max_fails and fail_timeout for passive checks, proxy_next_upstream error timeout http_502 http_503 for idempotent requests only, proxy_connect_timeout 2s to fail fast, and a backup server. Active checks need nginx Plus, nginx_upstream_check_module or an alternative like HAProxy/Envoy.

Be careful: proxy_next_upstream retrying POSTs can duplicate side effects, so set proxy_next_upstream_tries and exclude non-idempotent methods.

All Networking questions Roadmap: Networking for DevOps

More on Load Balancing, Proxies & nginx in Production