Should a 502 HTTP status code be used if a proxy receives no response at all?

HttpClientHttp Status-CodesStatus

Http Problem Overview


According to the RFC:

>10.5.3 502 Bad Gateway
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.

Can invalid response also mean no response at all (e.g. connection refused)?

Http Solutions


Solution 1 - Http

Yes. Empty or incomplete headers or response body typically caused by broken connections or server side crash can cause 502 errors if accessed via a gateway or proxy.

For more information about the network errors

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionprimrootView Question on Stackoverflow
Solution 1 - HttpblinkingledView Answer on Stackoverflow