Firstsawyou commented on a change in pull request #2817: URL: https://github.com/apache/apisix/pull/2817#discussion_r530781876
########## File path: doc/upstream-status-5xx.md ########## @@ -0,0 +1,151 @@ +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +[Chinese](zh-cn/upstream-status-5xx.md) + +## `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. Review comment: At present, if there are multiple retries between upstream and all upstream nodes are unavailable, `X-APISIX-Upstream-Status` records all status codes. For example: `$upstream_status` is `502, 500, 502`, then `X-APISIX-Upstream-Status: 502, 500, 502`. I think that when multiple retries between upstreams fail, all status codes should be recorded so that we can know the corresponding status codes between upstream nodes, which helps us to know the problems between upstream nodes. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org