panxiaoquan commented on code in PR #13268:
URL: https://github.com/apache/apisix/pull/13268#discussion_r3146279221


##########
apisix/plugins/forward-auth.lua:
##########
@@ -184,14 +218,31 @@ function _M.access(conf, ctx)
         return res.status, res.body
     end
 
-    -- set headers from the auth response, clearing any client-supplied values
-    -- for configured headers not present in the auth response
+    local code, body = attach_consumer_by_header(conf, ctx, res)
+    if code or body then
+        return code, body
+    end
+
+    -- append headers that need to be get from the auth response header
     for _, header in ipairs(conf.upstream_headers) do
         local header_value = res.headers[header]
-        -- if header_value is nil, the client header's value will be removed 
if it exists
-        core.request.set_header(ctx, header, header_value)
+        if header_value then
+            core.request.set_header(ctx, header, header_value)

Review Comment:
   Fixed in latest commit.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to