3 ms·
While API clients should be able to interpret the HTTP response code, 503 in this case, in a meaningful way, the API should have internal status/success codes t
by thwarted 16y ago
While API clients should be able to interpret the HTTP response code, 503 in this case, in a meaningful way, the API should have internal status/success codes that the body of the 5xx responses can contain.
Using haproxy to load balancer is no excuse for this, as you can tell haproxy to serve custom error documents using the errorfile option, and these error documents can be json or XML. And you can use layer 7 routing in haproxy to allow different configurations based on what the request looks like (in the case of, say, you were dumb and put everything your site does on a single domain, rather than putting the api on a different IP/subdomain).