Fix the http/tcp conditionals.

This commit is contained in:
Andrea Dell'Amico 2022-02-02 17:10:09 +01:00
parent 5fe2f1f535
commit adf6e0857a
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 8 additions and 1 deletions

View File

@ -86,6 +86,8 @@ frontend http
acl portainer_srv hdr(host) -i {{ docker_swarm_portainer_hostname }}
{% endif %}
{% for srv in docker_swarm_haproxy_additional_services %}
{% if srv.mode is defined and srv.mode == 'tcp' %}
{% else %}
acl {{ srv.acl_name }} {{ srv.acl_rule }}
{%if srv.acl_path_rule is defined %}acl {{ srv.acl_name }}_path {{ srv.acl_path_rule }}{% endif %}
@ -94,14 +96,18 @@ frontend http
http-request deny if {{ srv.acl_name }} !{{ srv.acl_name }}_nets
{% endif %}
{% endif %}
{% endfor %}
redirect scheme https code 301 if !{ ssl_fc }
{% if docker_swarm_cluster_portainer_install %}
use_backend portainer_bck if portainer_srv
{% endif %}
{% for srv in docker_swarm_haproxy_additional_services %}
{% if srv.mode is defined and srv.mode == 'tcp' %}
{% else %}
use_backend {{ srv.acl_name }}_bck if {{ srv.acl_name }} {%if srv.acl_path_rule is defined %}{{ srv.acl_name }}_path{% endif %}
{% endif %}
{% endfor %}
{% if docker_swarm_expose_api_via_haproxy %}
@ -222,6 +228,7 @@ backend {{ srv.acl_name }}_bck
{% endif %}
{% endif %}
server-template {{ srv.service_name }}- {{ srv.service_replica_num }} {{ srv.stack_name }}_{{ srv.service_name }}:{{ srv.service_port }} {{ srv.backend_options | default('') }} {% if srv.http_check_enabled is defined and srv.http_check_enabled %}check {{ srv.check_options | default('') }}{% endif %} resolvers docker init-addr libc,none
{% endfor %}
{% endif %}
{% endfor %}