The DevOps Drop
Home / Encyclopedia / HTTP Status Codes / 5xx Server Error Responses / 502 Bad Gateway

502 Bad Gateway

The HTTP 502 Bad Gateway status code indicates that a server acting as a gateway or proxy received an invalid response from an upstream server.

Published 16 Jul 2026 · HTTP Status Code

What is HTTP 502 Bad Gateway?

The 502 Bad Gateway status code occurs when a proxy or gateway cannot communicate correctly with an upstream service.

It is commonly seen in environments using reverse proxies, load balancers, and distributed applications.

Common Causes

  • Backend service failures
  • Application crashes
  • Incorrect proxy configuration
  • Network connectivity issues
  • DNS problems

Common DevOps Scenarios

  • Nginx proxy errors
  • Load balancer failures
  • Container crashes
  • Unavailable upstream services

Troubleshooting

Engineers should check both the gateway and the upstream application logs.

Summary

The 502 Bad Gateway response indicates communication failure between servers.