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 2022/11/08 10:36:26 UTC

[GitHub] [apisix] tokers commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf

tokers commented on code in PR #8275:
URL: https://github.com/apache/apisix/pull/8275#discussion_r1016443503


##########
apisix/init.lua:
##########
@@ -263,6 +263,16 @@ local function set_upstream_headers(api_ctx, picked_server)
     if x_forwarded_host then
         api_ctx.var.var_x_forwarded_host = x_forwarded_host
     end
+
+    local x_forwarded_for = api_ctx.var.http_x_forwarded_for
+    if x_forwarded_for then
+        api_ctx.var.http_x_forwarded_for = x_forwarded_for .. ", " .. api_ctx.var.realip_remote_addr

Review Comment:
   One can remove the var value in serverless plugins, so please check the value before concating 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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org