Use this playbook to separate invalid upstream responses (502) from upstream wait expiration (504), align deadlines, and apply safe retry controls.
Last reviewed: February 20, 2026|Editorial standard: source-backed operational guidance
502 means a gateway/proxy received an invalid upstream response, while 504 means the gateway/proxy did not receive a timely upstream response.
A caller or intermediary deadline can expire before the upstream operation finishes, so the client receives a timeout-class failure even if backend work completes later.
No. Use bounded exponential backoff with jitter on retry-safe operations only. Non-idempotent writes need idempotency protection before automated retries.