This commit is contained in:
Manuel de Brito Fontes 2017-09-29 09:57:16 -03:00
parent db12b517c9
commit fe2386b0a6

View file

@ -180,12 +180,7 @@ http {
map {{ buildForwardedFor $cfg.ForwardedForHeader }} $the_real_ip { map {{ buildForwardedFor $cfg.ForwardedForHeader }} $the_real_ip {
{{ if (trustProxyProtocol $cfg) }} {{ if (trustProxyProtocol $cfg) }}
# Get IP address from Proxy Protocol # Get IP address from Proxy Protocol
{{ if (ne (len $cfg.ProxyRealIPCIDR) 0) }}
# using trusted real IP CIDR
default $realip_remote_addr;
{{ else }}
default $proxy_protocol_addr; default $proxy_protocol_addr;
{{ end }}
{{ else }} {{ else }}
# Get IP from direct remote address # Get IP from direct remote address
default $realip_remote_addr; default $realip_remote_addr;
@ -297,10 +292,12 @@ http {
{{ range $server := $upstream.Endpoints }}server {{ $server.Address | formatIP }}:{{ $server.Port }} max_fails={{ $server.MaxFails }} fail_timeout={{ $server.FailTimeout }}; {{ range $server := $upstream.Endpoints }}server {{ $server.Address | formatIP }}:{{ $server.Port }} max_fails={{ $server.MaxFails }} fail_timeout={{ $server.FailTimeout }};
{{ end }} {{ end }}
} }
{{ end }} {{ end }}
upstream {{ $upstream.Name }} { upstream {{ $upstream.Name }} {
# Load balance algorithm; empty for round robin, which is the default # Load balance algorithm; empty for round robin, which is the default
{{ if ne $cfg.LoadBalanceAlgorithm "round_robin" }} {{ if ne $cfg.LoadBalanceAlgorithm "round_robin" }}