Skip to content
All tags

#reverse-proxy

3 posts
tech guide

nginx Restarted Fine, but Cloudflare Keeps Returning 502 — Even Though the Origin Is Healthy

A brief error during nginx restart caused Cloudflare to mark the origin as unhealthy and stop forwarding requests, returning 502 on its own. The key clues: localhost hits to the origin return 200, and nginx access logs are completely empty. Just wait for Cloudflare to automatically re-check the origin — it recovers on its own.

tech guide

Managing Multi-Service Reverse Proxy with nginx conf.d: A Daodao Case Study

A monolithic nginx.conf becomes unwieldy as services grow. Splitting it into per-service files under conf.d/ via include is the standard solution.

tech guide

nginx First Request Always 502, All Subsequent Requests Fine

When nginx uses the `set $variable` pattern for dynamic upstreams, the DNS cache expires every 30 seconds — the first request after expiry hits a 502 because no IP is available. Upgrading to nginx 1.27.3 and switching to an upstream block with the resolve parameter fixes this: DNS updates happen asynchronously in the background.