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



##########
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 for APISIX

##########
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)
+        core.log.info("X-Apisix-Upstream-Status:", status_code)

Review comment:
       What about adding a space after `:`.

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

Review comment:
       Not all requests will be proxied to upstream, requests terminated by 
APISIX itself will have null value of `$upstream_status`, we have to check the 
validity of `status_code`.




----------------------------------------------------------------
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:
[email protected]


Reply via email to