Skip to content
All tags

#nginx

5 posts
tech guide

nginx 502: Debugging Cross-Compose Container DNS Resolution

Service names aren't resolvable across Compose projects — you need to add a network alias so nginx can find the container.

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.

tech guide

Cloudflare Free Plan Maintenance Page: Custom Error Pages Unavailable, Use a Worker Instead

Cloudflare Custom Error Pages require a paid plan. On the Free Plan, use a Worker with inline HTML to intercept 5xx responses instead.