[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1064448333 ## apisix/init.lua: ## @@ -267,6 +267,11 @@ local function set_upstream_headers(api_ctx, picked_server) api_ctx.var.var_x_forwarded_host = x_forwarded_host end +local x_forwarded_for = api_ctx.var.proxy_add_x_forwarded_for +if x_forwarded_for then +api_ctx.var.var_x_forwarded_for = x_forwarded_for Review Comment: Done -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1063212619 ## apisix/init.lua: ## @@ -267,6 +267,11 @@ local function set_upstream_headers(api_ctx, picked_server) api_ctx.var.var_x_forwarded_host = x_forwarded_host end +local x_forwarded_for = api_ctx.var.proxy_add_x_forwarded_for +if x_forwarded_for then +api_ctx.var.var_x_forwarded_for = x_forwarded_for Review Comment: So we don't need `var_x_forwarded_for`? But `var_x_forwarded_proto` , `var_x_forwarded_host`, `var_x_forwarded_port` are still needed, because they have default value, right ? -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1063212619 ## apisix/init.lua: ## @@ -267,6 +267,11 @@ local function set_upstream_headers(api_ctx, picked_server) api_ctx.var.var_x_forwarded_host = x_forwarded_host end +local x_forwarded_for = api_ctx.var.proxy_add_x_forwarded_for +if x_forwarded_for then +api_ctx.var.var_x_forwarded_for = x_forwarded_for Review Comment: so we don't need `var_x_forwarded_for`? -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1063077396 ## apisix/core/ctx.lua: ## @@ -201,6 +201,7 @@ do var_x_forwarded_proto = true, var_x_forwarded_port = true, var_x_forwarded_host = true, +var_x_forwarded_for = true, Review Comment: Done ## apisix/init.lua: ## @@ -267,6 +267,17 @@ local function set_upstream_headers(api_ctx, picked_server) api_ctx.var.var_x_forwarded_host = x_forwarded_host end +local x_forwarded_for = api_ctx.var.http_x_forwarded_for Review Comment: Done -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1061307886 ## t/plugin/proxy-rewrite3.t: ## @@ -455,3 +455,99 @@ passed GET /echo HTTP/1.1 --- response_headers test: test_in_set + + + +=== TEST 21: set route (test if X-Forwarded-Port can be set before proxy) Review Comment: `X-Forwarded-For` is added like other `X-Forwarded-*` header -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1061305732 ## t/plugin/proxy-rewrite3.t: ## @@ -455,3 +455,99 @@ passed GET /echo HTTP/1.1 --- response_headers test: test_in_set + + + +=== TEST 21: set route (test if X-Forwarded-Port can be set before proxy) Review Comment: @spacewander could you check this PR again, the https://github.com/apache/apisix/pull/8404 is closed now, and all ci passed -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #8275: refactor: remove if statement in nginx.conf
monkeyDluffy6017 commented on code in PR #8275: URL: https://github.com/apache/apisix/pull/8275#discussion_r1016838033 ## 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: Done -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org