Remove localhost calls from external names
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
This commit is contained in:
parent
22ae0d3848
commit
0dceedfad7
6 changed files with 74 additions and 1 deletions
|
|
@ -35,6 +35,9 @@ local IMPLEMENTATIONS = {
|
|||
ewma = ewma,
|
||||
}
|
||||
|
||||
local PROHIBITED_LOCALHOST_PORT = configuration.prohibited_localhost_port or '10246'
|
||||
local PROHIBITED_PEER_PATTERN = "^127.*:" .. PROHIBITED_LOCALHOST_PORT .. "$"
|
||||
|
||||
local _M = {}
|
||||
local balancers = {}
|
||||
local backends_with_external_name = {}
|
||||
|
|
@ -317,6 +320,11 @@ function _M.balance()
|
|||
return
|
||||
end
|
||||
|
||||
if peer:match(PROHIBITED_PEER_PATTERN) then
|
||||
ngx.log(ngx.ERR, "attempted to proxy to self, balancer: ", balancer.name, ", peer: ", peer)
|
||||
return
|
||||
end
|
||||
|
||||
ngx_balancer.set_more_tries(1)
|
||||
|
||||
local ok, err = ngx_balancer.set_current_peer(peer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue