diff --git a/backend/templates/stream.conf b/backend/templates/stream.conf index c7848223..6c328c14 100644 --- a/backend/templates/stream.conf +++ b/backend/templates/stream.conf @@ -5,8 +5,16 @@ {% if enabled %} upstream stream_{{ incoming_port }}_tcp { + {% if forwarding_hosts.length > 1 -%} + least_conn; + {%- endif -%} + {% for forwarding_host in forwarding_hosts %} + {% if forloop.first == true and forloop.last == true -%} server {{ forwarding_host }}:{{ forwarding_port }}; + {%- else -%} + server {{ forwarding_host}}:{{ forwarding_port}} max_fails=3; + {%- endif %} {%- endfor %} }