Skip to content

Commit

Permalink
fix: host_hdr should not be false
Browse files Browse the repository at this point in the history
  • Loading branch information
kingluo committed Mar 23, 2023
1 parent 8197e03 commit 59af9bc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apisix/upstream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
local ok, err = checker:add_target(node.host, port or node.port, host,
true, host_hdr)
if not ok then
Expand Down

0 comments on commit 59af9bc

Please sign in to comment.