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/23 14:27:37 UTC

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

membphis commented on a change in pull request #2817:
URL: https://github.com/apache/apisix/pull/2817#discussion_r528739086



##########
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 and status_code >= 500 and status_code <= 599 then
+        core.response.set_header("X-APISIX-Upstream-Status", status_code)

Review comment:
       How about `X-Upstream-Status`?

##########
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"))

Review comment:
       `get_var("upstream_status")`, is this wrong? 
   please confirm do we need to fix it?




----------------------------------------------------------------
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