Reference guide · http-status · Published 2026-08-16 · 4 min read

Where your 5xx class error comes from

5xx error family meaning, which server layer returns 500, 502, 503, 504 and 599, and how to react to each one.

The 5xx family in one line

Every 5xx code says "the server could not or would not complete the request". The family tells you which layer gave up: the code itself (500), the reverse proxy's origin (502), a deliberate or transient outage (503), the timeout between the proxy and origin (504), and the uncommon 599 Network Connect Timeout used by some proxies.

The stack that produces them

visitor -> CDN/proxy -> web server -> application (PHP/node) -> database

A 5xx is the network path pointing back at the last healthy layer:

CodeThe layer that answersWhat it usually means
500The application or web server itselfAn exception or fatal, or a server misconfig
501The serverThe method is not implemented for this server
502A proxy between two layersUpstream sent a bad response or went away
503The server itselfDeliberately unavailable: maintenance, overload, drain
504A proxy (or the server)Upstream did not answer in time
599A front proxyThe proxy itself had a network timeout

That is why a single 502 points at the origin or the connection between the edge and origin, not at your PHP: an edge that receives a bad origin response converts the origin fault into a 502 by design. The 502 article covers the mapping in detail.

Code by code, with the structural cause

The one metric to add on a 5xx

Instrument at the layer that owns the failure, not at the page. An edge log that records $status per request and a breakdown of upstream_status for 502/504 (the origin's own HTTP status when the edge gives up) tells you within minutes whether the origin returned a real 500 (application fault) or no response (connection or timeout). Most CDNs and proxies expose the upstream status in their logs. That one field is the difference between "the PHP crashed" and "the full server is down", and it points you to the right article below.

When a 5xx is not a server fault

Where each goes next

The family maps to its own drill: the 500 article for application breaks, the 502 for proxy-origin, and the 503 + retry header for scheduling. If you are staring at a repeatable 5xx and do not yet know which of these it is, the troubleshooting order walks the first 15 minutes in the right sequence.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services