Supply max_fails=0 on all server entries
If nginx-proxy is run on a host whose docker config has multiple networks, then it will generate an additional server XXX down; entry in each upstream for networks on which the container _isn't_. Having more than one server entry in an upstream invokes nginx's max_fails/fail_timeout behavior, which will mark the only live upstream server as down for 10s if it returns ONE error response. Instead, we want nginx to keep retrying the live upstream server regardless of what it returns, since there's nothing else to try. Passing "max_fails=0" on each live server entry disables the max_fails/fail_timeout behavior.
This commit is contained in:
parent
d9d7a3354d
commit
f89d0c0620
1 changed files with 3 additions and 3 deletions
|
|
@ -9,16 +9,16 @@
|
|||
{{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}
|
||||
{{ if and .Container.Node.ID .Address.HostPort }}
|
||||
# {{ .Container.Node.Name }}/{{ .Container.Name }}
|
||||
server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }};
|
||||
server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }} max_fails=0;
|
||||
{{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}}
|
||||
{{ else if .Network }}
|
||||
# {{ .Container.Name }}
|
||||
server {{ .Network.IP }}:{{ .Address.Port }};
|
||||
server {{ .Network.IP }}:{{ .Address.Port }} max_fails=0;
|
||||
{{ end }}
|
||||
{{ else if .Network }}
|
||||
# {{ .Container.Name }}
|
||||
{{ if .Network.IP }}
|
||||
server {{ .Network.IP }}:{{ .VirtualPort }};
|
||||
server {{ .Network.IP }}:{{ .VirtualPort }} max_fails=0;
|
||||
{{ else }}
|
||||
# /!\ No IP for this network!
|
||||
{{ end }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue