502 Bad Gateway

HTTP 502 Bad Gateway: the IANA registry entry, its reference and class, what it means and what usually causes it.

Updated

HTTP 502 Bad Gateway is a registered status code in the 5xx Server Error class.

IANA registration

Field Value
Code 502
Description, as registered Bad Gateway
Reference RFC 9110, Section 15.6.3
Class 5xx Server Error

Source: IANA Hypertext Transfer Protocol (HTTP) Status Code Registry, as downloaded on December 5, 2026. The registry changes over time; the linked page is the authority.

The 5xx class

The first digit of a status code gives its class. A 5xx (Server Error) code means the server failed to fulfil an apparently valid request. A client that does not recognize a particular code can treat it as the x00 code of its class. The classes are defined in RFC 9110, Section 15.

What it means in practice

This section is written by Network Utility. It is not part of the IANA registry.

A server acting as a gateway or proxy received an invalid response from the upstream server it contacted.

What usually causes it. Typical causes are an application process that has crashed or is restarting, a proxy pointed at the wrong address or port, and an upstream that closes the connection mid-request.

See also: 502 Bad Gateway: causes and how to find the fault.