Technology / Analysis & practical perspectives

Investigate 502 across three boundaries, before restarting everything

Separate client, proxy and upstream faults using time and request identifiers, with a short investigation path that avoids premature conclusions.

ADArdeshir Daryani··2 min read
Concept illustration of a server and request path with a response checkpoint
An original AI-generated conceptual illustration; not an accurate depiction of a commercial product or architecture.

Technical source: MDN’s definition of 502 Bad Gateway. The sequence below is an independent proposal.

A 502 usually indicates that a gateway or proxy received an invalid upstream response. It does not identify a broken database or justify restarting every server by itself.

Three boundaries, three questions

  1. Client to gateway: Which hostname, path and time are affected? Does it recur across connections?
  2. Gateway to application: Do destination, port, hostname and connection method match the approved configuration? What did the proxy record then?
  3. Application and dependencies: Did the request arrive, and where did it fail or stop?

A common identifier and timestamp connect the findings. An old log message is not automatically the cause of today’s request.

A hypothetical example

After deployment, the proxy’s destination port differs from the application’s port. The application is healthy but routing is wrong. Restarting the database targets neither cause and may add disruption.

Completion criteria

Retest the same user path while observing proxy and application responses. An open port or a different working page is insufficient. If changing configuration, change one factor and record outcome and rollback.

Related reading: what to record before restarting.

Source checked: November 2, 2026. The example is hypothetical; a status code does not replace evidence and product-specific configuration checks.

Technology analysis for more informed decisions.All posts →