You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/22 13:23:03 UTC

[GitHub] [apisix] nic-chen commented on a change in pull request #2817: feat: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

nic-chen commented on a change in pull request #2817:
URL: https://github.com/apache/apisix/pull/2817#discussion_r528335041



##########
File path: apisix/init.lua
##########
@@ -629,6 +630,12 @@ end
 function _M.http_header_filter_phase()
     core.response.set_header("Server", ver_header)
 
+    local status_code = tonumber(get_var("upstream_status"))
+    if status_code >= 500 and status_code <=599 then
+        core.response.set_header("X-Apisix-Upstream-Status", status_code)

Review comment:
       Agree +1




----------------------------------------------------------------
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:
users@infra.apache.org