You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Yuelin Zheng <zy...@163.com> on 2021/01/22 07:22:55 UTC

[DISCUSS] Adjust the unreasonable response code used in APISIX

Hi, Community,

I’m very sorry, because there were some problems with the title and format of 
the previous "Adjust the unreasonable response code used in APISIX" email, 
so I re-sent this email. Thanks for understanding.
Below we need to discuss the issues.


In APISIX, the use of some response codes is unreasonable, and these 
unreasonable response codes can easily mislead people in troubleshooting. 

I think these unreasonable response codes need to be adjusted.


For example, here in the apisix/upstream.lua file:

https://github.com/apache/apisix/blob/master/apisix/upstream.lua#L134
https://github.com/apache/apisix/blob/master/apisix/upstream.lua#L175


When the upstream configuration is missing or there is no available upstream node,
a 500 or 502 response code will be returned. I think this is unreasonable, 
because this is not caused by a code program error or the upstream cannot respond to the request normally, 
but because there is no upstream available.  Therefore, it is more reasonable to use the 503 response code.
Although the modification of these response codes will break compatibility, 
it will make APISIX's response codes more standardized and help people quickly locate the source of the problem.

What do you think?


Thanks,
Yuelin Zheng