HTTP

502 Bad Gateway

The server, acting as a gateway or proxy, received an invalid response from the upstream server.

When You See This Code

When Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).

How to Fix

Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts.

Specification

View RFC / Specification →

Related Codes

Cross-Protocol Equivalents

Comparisons

Guides

Glossary