Envelope
Codes
Headers worth handling
Recommended retry strategy
1
Honor Retry-After first
For
429, 502, 504, sleep for the value of Retry-After (with a
small jitter) before the next attempt.2
Cap retries on terminal codes
400, 401, 403, 404, 422 are user errors — retrying won’t help.
Surface them to the caller.3
Bound everything
Apply an outer deadline on every request and limit retries to e.g. 3
attempts so a degraded backend can’t spiral your client.