From 15e69198d3744abdbe46618be802fdea4a2a4e2a Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 14 Mar 2016 20:47:02 +0100 Subject: [PATCH] Optimize frontend names and drop requests with no matching host --- templates/haproxy_cfg | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index 714dfb3..b485d09 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -41,7 +41,7 @@ listen stats stats uri /haproxy_stats stats realm LoadBalancerStats -frontend http-in +frontend http_in bind *:80 acl blockedip src -i -f /etc/haproxy/blacklist http-request deny if blockedip @@ -66,7 +66,7 @@ frontend http-in {% endfor %} {% for cert in proxy_certificates %} -frontend https-in-{{ cert.ip }} +frontend https_in_{{ cert.ip }} bind {{ cert.ip }}:443 ssl crt /etc/haproxy/certs/{{ cert.file }} no-sslv3 acl blockedip src -i -f /etc/haproxy/blacklist http-request deny if blockedip @@ -93,7 +93,11 @@ frontend https-in-{{ cert.ip }} {% for host in groups['all'] %} backend backend_{{host}} +{% if host == inventory_hostname %} + http-response deny +{% else %} server server_{{host}} {{hostvars[host]['static_ipv4']|default(hostvars[host]['ansible_default_ipv4']['address'])}}:80 maxconn 32 +{% endif %} {% endfor %} {% if varnish_host|default(false) %} -- GitLab