diff --git a/tasks/haproxy_networks.yml b/tasks/haproxy_networks.yml index 9686351..e0d8700 100644 --- a/tasks/haproxy_networks.yml +++ b/tasks/haproxy_networks.yml @@ -10,19 +10,19 @@ - name: Connect haproxy to the overlay networks docker_compose: - project_name: '{{ docker_haproxy_service_name }}' + project_name: haproxy_haproxy definition: services: - '{{ docker_haproxy_service_name }}': + haproxy_haproxy: networks: '{{ docker_swarm_haproxy_networks }}' ignore_errors: True - name: Connect haproxy to the overlay networks docker_compose: - project_name: '{{ docker_haproxy_service_name }}' + project_name: haproxy_haproxy definition: services: - '{{ docker_haproxy_service_name }}': + haproxy_haproxy: networks: '{{ docker_swarm_haproxy_additional_networks }}' ignore_errors: True diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index 2d95816..536757a 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -73,10 +73,12 @@ listen local_stats frontend http bind *:{{ https_port }} ssl crt {{ haproxy_cert_dir }} alpn h2,http/1.1 {% if docker_swarm_haproxy_installation_type == 'global' %}accept-proxy{% endif %} + bind *:{{ haproxy_default_port }} {% if docker_swarm_haproxy_installation_type == 'global' %}accept-proxy{% endif %} + mode http - option httplog option http-keep-alive + redirect scheme https code 301 if !{ ssl_fc } http-request add-header X-Forwarded-Proto https # HSTS (63072000 seconds) http-response set-header Strict-Transport-Security max-age=63072000 @@ -100,7 +102,6 @@ frontend http {% endif %} use_backend {{ srv.acl_name }}_bck if {{ srv.acl_name }} {% endfor %} - redirect scheme https code 301 if !{ ssl_fc } # # Backends @@ -110,7 +111,6 @@ frontend http # swarm API backend swarm_api_bck mode http - option httplog balance roundrobin server swarm 127.0.0.1:{{ docker_api_port }} {% endif %} @@ -118,7 +118,6 @@ backend swarm_api_bck {% if docker_swarm_cluster_portainer_install %} backend portainer_bck mode http - option httplog option httpchk http-check send meth HEAD uri / ver HTTP/1.1 hdr Host localhost http-check expect rstatus (2|3)[0-9][0-9]