Is it correct to return a 502 status code when it's my proxy that has an internal error?
Question
I've written a small proxy, and I'm wondering if it's correct for me to return a 502 Bad Gateway
error when the proxy server itself has an internal error. The RFC seem to say that this is something you only do if the server on the other end gives a bad response.
The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
I take this to mean that if for example the upstream server is setting a content-length
header that is different from the response body length, we should set a 502
error i.e. when the response is invalid.
Am I misinterpreting the RFC?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow