Merge pull request #4246 from ElvinEfendi/proxy-alternative-upstream-name

introduce proxy_alternative_upstream_name Nginx var
This commit is contained in:
Kubernetes Prow Robot 2019-07-04 19:20:35 -07:00 committed by GitHub
commit 7c297e001a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View file

@ -198,8 +198,10 @@ local function get_balancer()
end
if route_to_alternative_balancer(balancer) then
local alternative_balancer = balancers[balancer.alternative_backends[1]]
return alternative_balancer
local alternative_backend_name = balancer.alternative_backends[1]
ngx.var.proxy_alternative_upstream_name = alternative_backend_name
return balancers[alternative_backend_name]
end
return balancer

View file

@ -1084,6 +1084,8 @@ stream {
set $proxy_upstream_name "{{ buildUpstreamName $location }}";
set $proxy_host $proxy_upstream_name;
set $proxy_alternative_upstream_name "";
{{ if (or $location.ModSecurity.Enable $all.Cfg.EnableModsecurity) }}
{{ if not $all.Cfg.EnableModsecurity }}
modsecurity on;