Render 502 Bad Gateway Error
Quick answer
A 502 on Render usually means no healthy instance is serving: failed deploy, wrong host/port, failing health checks, or worker timeouts. Check the logs first.
Most likely fix: Check the deploy and logs
How to fix it
Try these in order — the most common fix is first.
1. Check the deploy and logs
- Confirm the latest deploy is Live
- Read runtime logs around the time of the error
Did this fix it?2. Fix host, port and health check
- Bind to 0.0.0.0:$PORT
- Make the health check path return 2xx or 3xx quickly
Did this fix it?3. Fix intermittent 502 on Node
- Increase keepAliveTimeout and headersTimeout above 120 seconds on your HTTP server
Did this fix it?4. Fix worker timeouts on Python
- Raise the Gunicorn --timeout value or speed up slow requests
Did this fix it?
Symptoms
Visiting the service returns 502 Bad Gateway, sometimes only intermittently.
Why it happens
- No successful deploy yet
- Instance failing health checks
- Server not bound to 0.0.0.0 and PORT
- New custom domain still propagating (up to an hour)
- Node keepAliveTimeout lower than the proxy's, giving Connection reset by peer
- Gunicorn worker timeout (WORKER TIMEOUT, SIGKILL)
This guide also covers
- render 502 bad gateway
- render 503 service unavailable
- render connection reset by peer
Still not working?
If Render keeps failing, you're not alone. See every Render problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
Other Render errors
- Render Free Instance Spins Down: Slow First Request
- Render "No Open Ports Detected" Deploy Error
- Render Build or Service Out of Memory
- Render Build Failed: Exited With Status 1
- Render Free Postgres Expired or Deleted
- Render Custom Domain Verification or SSL Pending
- Render Health Check Failed or Deploy Timed Out
- Render Free Service Suspended: 750 Hours Used Up