global
    log 127.0.0.1    local0
    log 127.0.0.1    local1 notice
    chroot /var/lib/haproxy
    user haproxy
    group haproxy
    #daemon

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000

frontend localnodes
    bind *:8080
    mode http    
    default_backend nodes

backend nodes
    mode http
    balance roundrobin
    option forwardfor
#    http-request set-header X-Forwarded-Port %[dst_port]
#    http-request add-header X-Forwarded-Proto https if { ssl_fc }
#    option httpchk GET / HTTP/1.1\r\nHost:localhost
    server web01 api1:8080 check
    server web02 api2:8080 check

listen stats :8085
    stats enable
    stats uri /