You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

55 lines
1.4 KiB

global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
frontend main
bind *:80
{% if install_certbot %}
bind *:443 ssl crt "/etc/letsencrypt/live/{{ domain_name }}/{{ domain_name }}.pem"
http-request redirect scheme https unless { ssl_fc }
{% endif %}
{% for c in groups['containers'] %}
{% if c != 'haproxy' %}
acl {{ c }}_path path_beg -i /{{ c }}
use_backend {{ c }} if {{ c }}_path
{% endif %}
{% endfor %}
{% for c in groups['containers'] %}
{# NOTE: don't add haproxy to list of containers :P #}
{% if c != 'haproxy' %}
backend {{ c }}
{# NOTE: gallery container expects /gallery/ prefix #}
{% if c != 'gallery' %}
http-request replace-path /{{ c }}/(.*) /\1
{% endif %}
server {{ c }}_1 {{ c }}.lxd:80 check
{% endif %}
{% endfor %}