You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "kingluo (via GitHub)" <gi...@apache.org> on 2023/03/24 04:18:07 UTC

[GitHub] [apisix] kingluo commented on a diff in pull request #9150: fix: host_hdr should not be false

kingluo commented on code in PR #9150:
URL: https://github.com/apache/apisix/pull/9150#discussion_r1147101728


##########
apisix/upstream.lua:
##########
@@ -134,10 +134,13 @@ local function create_checker(upstream)
 
     local host = upstream.checks and upstream.checks.active and upstream.checks.active.host
     local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
-    local up_hdr = upstream.pass_host == "rewrite" and upstream.upstream_host
-    local use_node_hdr = upstream.pass_host == "node"
     for _, node in ipairs(upstream.nodes) do
-        local host_hdr = up_hdr or (use_node_hdr and node.domain)
+        local host_hdr
+        if upstream.pass_host == "rewrite" and upstream.upstream_host then
+            host_hdr = upstream.upstream_host
+        elseif upstream.pass_host == "node" and node.domain then
+            host_hdr = node.domain
+        end

Review Comment:
   @monkeyDluffy6017 Yes, it's the [same](https://www.lua.org/manual/5.1/manual.html#2.5.3), but it's not as clear as explicit conditional statements.



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