# this config needs haproxy-1.1.28 or haproxy-1.2.1

global
    log 127.0.0.1    local0
    log 127.0.0.1    local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    stats socket /var/run/haproxy.sock
    user haproxy
    group haproxy
    daemon
    #debug
    #quiet

defaults
    log    global
    mode    http
    option    httplog
    option    dontlognull
    retries    3
    option redispatch
    stats enable
    stats uri /haproxy
    maxconn    2000
    contimeout    5000
    clitimeout    50000
    srvtimeout    50000


listen    nova-api 0.0.0.0:8773
    option httpchk GET / HTTP/1.0\r\nHost:\ example.com
    option forwardfor
    reqidel ^X-Forwarded-For:.*
    balance    roundrobin
<% api_servers.to_i.times do |offset| %><% port = api_base_port.to_i + offset -%>
    server    api_<%= port %> 127.0.0.1:<%= port %> maxconn 1 check 
<% end -%>
    option    httpclose        # disable keep-alive
