## `5xx` response status code Similar `5xx` status codes such as 500, 502, 503, etc., are the status codes in response to a server error. When a request has a `5xx` status code; it may come from `APISIX` or `Upstream`. How to identify the source of these response status codes is a very meaningful thing. It can quickly help us determine the problem. ## How to identify the source of the `5xx` response status code In the response header of the request, through the response header of `X-APISIX-Upstream-Status`, we can effectively identify the source of the `5xx` status code. When the `5xx` status code comes from `Upstream`, the response header `X-APISIX-Upstream-Status` can be seen in the response header, and the value of this response header is the response status code. When the `5xx` status code is derived from `APISIX`, there is no response header information of `X-APISIX-Upstream-Status` in the response header. That is, only when the status code of `5xx` is derived from Upstream will the `X-APISIX-Upstream-Status` response header appear. ## Example >Example 1: `502` response status code comes from `Upstream` (IP address is not available) ```shell $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "methods": ["GET"], "upstream": { "nodes": { "127.0.0.1:1": 1 }, "type": "roundrobin" }, "uri": "/hello" }' ``` Test: ```shell $ curl http://127.0.0.1:9080/hello -v ...... < HTTP/1.1 502 Bad Gateway < Date: Wed, 25 Nov 2020 14:40:22 GMT < Content-Type: text/html; charset=utf-8 < Content-Length: 154 < Connection: keep-alive < Server: APISIX/2.0 < X-APISIX-Upstream-Status: 502 <