Fix: API 502 Bad Gateway
Confirm upstream process is running and healthy
502 means your proxy got nothing usable from upstream — the app crashed, closed the connection, or timed out. Check upstream health before tweaking the proxy.
Frequently Asked Questions
What causes API 502 Bad Gateway?
502 means your proxy got nothing usable from upstream — the app crashed, closed the connection, or timed out. Check upstream health before tweaking the proxy.
How to fix API 502 Bad Gateway?
Check upstream app health (restarts, OOMs). Inspect Nginx error log for `upstream prematurely closed connection` — it points to a crash or a keepalive mismatch.
Example fix from Kintify Fix
Input: Nginx returning 502 intermittently
Output: Check upstream app health (restarts, OOMs). Inspect Nginx error log for `upstream prematurely closed connection` — it points to a crash or a keepalive mismatch.
Used by developers debugging real production systems