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
    stats socket *:{{SOCK_PORT}} level admin
    stats socket /var/run/haproxy.sock mode 600 level admin
	{% if haproxy_version == '1.6' %}
    server-state-file {{STAT_FILE}}
	{% endif %}

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

listen stats 
    bind *:{{STAT_PORT}} 
    stats enable
    stats uri /stats
    stats realm HAProxy-04\ Statistics
    stats auth {{STATS_USER}}:{{STATS_PASS}}
    stats admin if TRUE
    
backend per_ip_and_url_rates
    stick-table type binary len 8 size 1m expire 24h store http_req_rate(24h)

backend per_ip_rates
    stick-table type ip size 1m expire 24h store gpc0,gpc0_rate(30s)
