global
    tune.ssl.default-dh-param 2048
    log         X.X.X.244:10514 local2 

    
    #log         127.0.0.1 local2
    #log-send-hostname haproxy
    #log 	X.X.X.131 local2


    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     10000
    user        haproxy
    group       haproxy
    daemon
    stats bind-process 1
    nbproc 8
    cpu-map odd 1 3 5 7 
    cpu-map even 2 4 6 8
    spread-checks 5


    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats level admin process 1
    stats socket /var/lib/haproxy/haproxy.1.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.2.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.3.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.4.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.5.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.6.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.7.sock level admin process 1
    stats socket /var/lib/haproxy/haproxy.8.sock level admin process 1




#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
#
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    option                  abortonclose
    retries                 3
    timeout http-request    10s
    timeout queue           2s
    timeout connect         5s
    timeout client          2m
    timeout server          2m
    timeout http-keep-alive 10s
    timeout check           5s
    maxconn                 400
    option prefer-last-server

listen stats1
    bind-process 1
    bind :8001
    stats enable
    stats uri /admin?stats
    stats realm HAProxy\ Statistics
    stats auth XXXX:YYYY


frontend grafana
    bind-process odd
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.169:3000
    maxconn 1000
    timeout client-fin 1s
    default_backend grafana-1
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }

backend grafana-1
    option  httpchk GET /login
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    #server grafana-1 X.X.X.70:3000  weight 100  check  inter  10s maxconn 2 maxqueue 1 slowstart 120s
    server grafana-1 X.X.X.171:3000  weight 100  check  inter  10s maxconn 2 maxqueue 1 slowstart 120s

frontend AdPlatform-In
    bind-process odd
    #http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall } or { hdr(host) -i nj.shooter.someservice.com }
    bind X.X.X.201:80
    bind X.X.X.202:80
    bind X.X.X.203:80
    bind X.X.X.204:80
    maxconn 10000
    timeout client-fin 10s
    default_backend adplatform
    capture request header User-Agent len 128
    capture request header Referer len 64
    capture request header Host len 64
    capture request header X-Forwarded-For len 64
    capture request header True-Client-IP len 500
    capture request header X-EdgeConnect-Session-Id len 500
    capture request header X-StartApp-Info len 500

frontend adPlatform-https
    bind-process even
    #http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall } or { hdr(host) -i nj.shooter.someservice.com }
    bind X.X.X.201:443 ssl crt /etc/haproxy/ssl/someexchange.com.pem crt /etc/haproxy/ssl/sc2s.somenetwork.com.pem crt /etc/haproxy/ssl/somenetwork.com.pem crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.202:443 ssl crt /etc/haproxy/ssl/someexchange.com.pem crt /etc/haproxy/ssl/sc2s.somenetwork.com.pem crt /etc/haproxy/ssl/somenetwork.com.pem crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.203:443 ssl crt /etc/haproxy/ssl/someexchange.com.pem crt /etc/haproxy/ssl/sc2s.somenetwork.com.pem crt /etc/haproxy/ssl/somenetwork.com.pem crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.204:443 ssl crt /etc/haproxy/ssl/someexchange.com.pem crt /etc/haproxy/ssl/sc2s.somenetwork.com.pem crt /etc/haproxy/ssl/somenetwork.com.pem crt /etc/haproxy/ssl/someservice.com.pem
    maxconn    10000
    redirect scheme https if !{ ssl_fc }
    mode http
    default_backend adplatform

frontend internalAdPlatform 
    bind-process odd
    bind X.X.X.8:10011
    bind X.X.X.221:10011
    bind X.X.X.222:10011
    bind X.X.X.223:10011
    bind X.X.X.224:10011
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option dontlog-normal
    maxconn    400
    option     httpclose
    default_backend adplatform

backend adplatform
    fullconn 2000
    timeout queue 1s
    option  httpchk GET /keepalive
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor
    timeout server 5s
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    # server web-13 X.X.X.53:8480  weight 80  check  inter  10s minconn 10 maxconn 2 maxqueue 1 slowstart 120s
    server web-22 X.X.X.148:8480  weight 50  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-23 X.X.X.149:8480  weight 50  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-24 X.X.X.150:8480  weight 120  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-25 X.X.X.151:8480  weight 180  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-26 X.X.X.152:8480  weight 180  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-27 X.X.X.153:8480  weight 180  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    server web-31 X.X.X.181:8480  weight 200  check  inter  10s minconn 10 maxconn 150 maxqueue 1 slowstart 120s
    server web-32 X.X.X.182:8480  weight 200  check  inter  10s minconn 10 maxconn 150 maxqueue 1 slowstart 120s
    server web-33 X.X.X.183:8480  weight 200  check  inter  10s minconn 10 maxconn 150 maxqueue 1 slowstart 120s
    server web-34 X.X.X.184:8480  weight 200  check  inter  10s minconn 10 maxconn 150 maxqueue 1 slowstart 120s
    server web-41 X.X.X.61:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-42 X.X.X.62:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-43 X.X.X.63:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-44 X.X.X.64:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-45 X.X.X.65:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-46 X.X.X.66:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-47 X.X.X.67:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-48 X.X.X.68:8480  weight 230  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-51 X.X.X.101:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-52 X.X.X.102:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-53 X.X.X.103:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-54 X.X.X.104:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-55 X.X.X.105:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-56 X.X.X.106:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-57 X.X.X.107:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server web-58 X.X.X.108:8480  weight 240  check  inter  10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s
    server stg-web2 X.X.X.178:8480  weight 80  check  inter  10s minconn 10 maxconn 100 maxqueue 1 slowstart 120s
    # server stg-web1 X.X.X.171:8480  weight 80  check  inter  10s minconn 10 maxconn 500 maxqueue 1 slowstart 120s


frontend StgAdPlatform
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    capture request header User-Agent len 128
    capture request header Referer len 64
    capture request header Host len 64
    capture request header X-Forwarded-For len 64
    capture request header True-Client-IP len 500
    capture request header X-EdgeConnect-Session-Id len 500
    capture request header X-StartApp-Info len 500
    bind X.X.X.147:443 ssl crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.148:443 ssl crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.147:80
    bind X.X.X.148:80
    mode http
    default_backend StgWebServers

backend StgWebServers
    option httpchk GET /keepalive
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server stg-web2 X.X.X.178:8480 weight 50 check  inter  10s minconn 20 maxconn 25
    server stg-web1 X.X.X.171:8480 weight 50 check  inter  10s minconn 20 maxconn 25
    server web-32   X.X.X.182:8480 weight 50  check inter  10s minconn 20 maxconn 25 backup
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

frontend StaticAdPlatform
    bind-process even
    capture request header User-Agent len 128
    capture request header Referer len 64
    capture request header Host len 64
    capture request header X-Forwarded-For len 64
    capture request header True-Client-IP len 500
    capture request header X-EdgeConnect-Session-Id len 500
    capture request header X-StartApp-Info len 500
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.143:80
    bind X.X.X.143:443 ssl crt /etc/haproxy/ssl/someservice.com.pem
    bind X.X.X.144:80
    bind X.X.X.144:443 ssl crt /etc/haproxy/ssl/someservice.com.pem
    mode http
    default_backend Static

backend Static
    option httpchk GET /keepalive
    balance roundrobin
    option forwardfor
    server web-12 X.X.X.52:8980 weight 50 check inter  10s minconn 20 maxconn 25
    server web-13 X.X.X.53:8980 weight 50 check inter  10s minconn 20 maxconn 25
    #server web-22 X.X.X.148:8480 weight 50  check inter  10s minconn 20 maxconn 25 backup
    #server web-23 X.X.X.149:8480 weight 50  check inter  10s minconn 20 maxconn 25 backup

frontend portal-internal
    bind-process odd
    maxconn 50
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    timeout http-request 60m
	bind X.X.X.8:8001 #for portal-ms-3504_port
	bind X.X.X.8:8002 #for portal-ms-3507_port
        bind X.X.X.8:8003 #for jobs_port
	bind X.X.X.8:8010 #for portal-ms-3510_port
	bind X.X.X.8:8008 #for portal-ms-3508_port
	bind X.X.X.8:8014 #for portal-ms-3514_port
	bind X.X.X.8:9090 #for Portal sync_port
	bind X.X.X.8:9009 #for messaging-dispatcher_port
	bind X.X.X.8:8016 #for messaging-dispatcher_port
	acl jobs_port dst_port 8003
	acl sync_port dst_port 9090
	acl messaging-dispatcher_port dst_port 9009
	acl portal-ms-3504_port dst_port 8001
	acl portal-ms-3514_port dst_port 8014
	acl portal-ms-3516_port dst_port 8016
	acl portal-ms-3507_port dst_port 8002
	acl portal-ms-3510_port dst_port 8010
	acl portal-ms-3508_port dst_port 8008
	use_backend nodes-mdisp-3502 if messaging-dispatcher_port
	use_backend nodes-internal-3504 if portal-ms-3504_port
	use_backend nodes-internal-3514 if portal-ms-3514_port
	use_backend nodes-internal-3507 if portal-ms-3507_port
	use_backend nodes-internal-3510 if portal-ms-3510_port
	use_backend nodes-internal-3508 if portal-ms-3508_port
	use_backend nodes-internal-3516 if portal-ms-3516_port
	use_backend nodes-internal-3513 if jobs_port
	use_backend nodes-apisync-3501 if  sync_port
    mode http
    default_backend nodes-internal-3513


backend nodes-internal-3504
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    option httpchk GET /
    server node-5 X.X.X.95:3504  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3504  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }


backend nodes-internal-3507
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3507  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3507  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

	

backend nodes-internal-3510
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3510  cookie A weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3510  cookie B weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }


backend nodes-internal-3508
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3508  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3508  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }


backend nodes-internal-3514
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3514  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3514  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
	
backend nodes-internal-3516
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3516  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3516  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
	

backend nodes-mdisp-3502
    timeout server 5m
    mode http
    option httpchk GET /
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3502  cookie E weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    server node-6 X.X.X.96:3502  cookie F weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    http-request set-header X-Forwarded-Port %[dst_port]
	

backend nodes-apisync-3501
    mode http
    timeout server 10m
    option httpchk GET /
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-5 X.X.X.95:3501  cookie E weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    server node-6 X.X.X.96:3501  cookie F weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    http-request set-header X-Forwarded-Port %[dst_port]


backend nodes-internal-3513
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    option httpchk GET /
    server node-5 X.X.X.95:3513  cookie A weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3513  cookie B weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }


######################################################



frontend node-stg
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    bind X.X.X.146:8443 ssl crt /etc/haproxy/ssl/someexchange.com.pem crt /etc/haproxy/ssl/portal.example.com.pem
    redirect scheme https if !{ ssl_fc }
    default_backend node-stg-3000
    mode http

frontend portal-stg-paypal
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    bind X.X.X.146:443 ssl crt /etc/haproxy/ssl/someexchange.com.pem
    redirect scheme https if !{ ssl_fc }
    acl url_paypal path_beg /adv/paypal/ipn
    use_backend node-stg-3000 if url_paypal
    mode http

backend node-stg-3000
    mode http
    balance roundrobin
    option http-server-close
    server node-stg-test X.X.X.145:3000  weight 50  maxconn 20 maxqueue 10

frontend portal-ssl
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    timeout http-request 60m
    bind X.X.X.145:80
    bind X.X.X.145:443 ssl crt /etc/haproxy/ssl/portal.example.com.pem
    redirect scheme https if !{ ssl_fc }
    mode http
    default_backend nodes-3000


backend nodes-3000
    mode http
    option httpchk GET /infra/keepalive
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    #server node-1 X.X.X.141:3000  cookie A weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    #server node-2 X.X.X.142:3000  cookie B weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    #server node-3 X.X.X.143:3000  cookie C weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    #server node-4 X.X.X.144:3000  cookie D weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    server node-5 X.X.X.95:3000  cookie E weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    server node-6 X.X.X.96:3000  cookie F weight 50  check  inter  10s minconn 5 maxconn 15 maxqueue 10
    server Er-500   X.X.X.121:80  weight 50  check  inter  10s minconn 20 maxconn 25 backup
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

frontend portal-hotfix-ssl
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    timeout http-request 60m
    bind X.X.X.145:9090
    bind X.X.X.145:8443 ssl crt /etc/haproxy/ssl/portal.example.com.pem
    redirect scheme https if !{ ssl_fc }
    mode http
    default_backend nodes-hotfix


backend nodes-hotfix
    mode http
    option httpchk GET /infra/keepalive
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    server node-stg7 X.X.X.140:3000  weight 50  check  inter  30s minconn 20 maxconn 25


listen node-3 
    bind X.X.X.145:3003
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    option     httpclose
    balance    roundrobin

    server node-3 X.X.X.143:3000 	weight 50  check  inter  10s minconn 20 maxconn 25

listen node-integration 
    bind X.X.X.145:9009
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    option     httpclose
    balance    roundrobin

    server node-integration X.X.X.111:9001  weight 50  check  inter  30s minconn 20 maxconn 25


frontend Cloudinary
    bind-process odd
        mode http
    	http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
        bind X.X.X.158:80
        default_backend Cloudinary-HTTP

backend Cloudinary-HTTP
        balance roundrobin
        server Web-test X.X.X.79:80 check inter 10s

frontend accounts-HTTP
    bind-process even
    	http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
        acl do_not_redirect src 61.216.8.103 198.74.51.48 45.79.66.181 45.79.64.91 45.79.102.207 54.241.44.2 31.168.97.98
        redirect location http://lp.example.com/going-wild if !do_not_redirect 
        bind X.X.X.157:80
        bind X.X.X.157:443 ssl crt /etc/haproxy/ssl/accounts.example.com.pem
        default_backend accounts-Farm-HTTP

backend accounts-Farm-HTTP
        balance roundrobin
        server Web-1 X.X.X.72:80 check inter 10s backup
        server Web-2 X.X.X.73:80 check inter 10s 


frontend searchGW
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.213:443 ssl crt /etc/haproxy/ssl/www.searchmobileonline.com.pem
    bind X.X.X.214:443 ssl crt /etc/haproxy/ssl/www.searchmobileonline.com.pem
    bind X.X.X.213:80
    bind X.X.X.214:80
    maxconn    5000
    default_backend Search

backend Search
    option httpchk GET /keepalive
    balance roundrobin
    mode http
    option forwardfor
    option     abortonclose
    option     httpclose
    server web-41 X.X.X.61:8180  weight 240  check  inter  10s minconn 10 maxconn 1000 rise 6 slowstart 120s
    server web-42 X.X.X.62:8180  weight 240  check  inter  10s minconn 10 maxconn 1000 rise 6 slowstart 120s
    server web-43 X.X.X.63:8180  weight 240  check  inter  10s minconn 10 maxconn 1000 rise 6 slowstart 120s
    server web-44 X.X.X.64:8180  weight 240  check  inter  10s minconn 10 maxconn 1000 rise 6 slowstart 120s

listen LDAP 
    bind X.X.X.169:9090
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    mode http
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server dp1 X.X.X.58:80

listen LDAP1 
    bind X.X.X.169:389
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    mode http
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server dp1 X.X.X.58:389 

frontend VAST
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.169:80
    bind X.X.X.169:443 ssl crt /etc/haproxy/ssl/someservice.com.pem
    maxconn    50
    default_backend WEB34

backend WEB34
    option  httpchk GET /keepalive
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    server web-34 X.X.X.184:8480  weight 230  check  inter  10s minconn 5 maxconn 15 maxqueue 1 slowstart 120s

frontend protocolGW
    bind-process odd
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.152:80
    maxconn    50
    default_backend protocol

backend protocol
    option  httpchk GET /keepalive
    timeout queue           1ms
    balance    roundrobin

    server web-41 X.X.X.61:8280  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-42 X.X.X.62:8280  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-43 X.X.X.63:8280  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-44 X.X.X.64:8280  weight 50  check  inter  10s minconn 10 maxconn 200


listen appwallGW 
    bind X.X.X.212:80
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /keepalive
    maxconn    600
    option     abortonclose
    option     httpclose
    balance    roundrobin
    cookie JSESSIONID prefix

    server web-41 X.X.X.61:8580  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-42 X.X.X.62:8580  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-43 X.X.X.63:8580  weight 50  check  inter  10s minconn 10 maxconn 200
    server web-44 X.X.X.64:8580  weight 50  check  inter  10s minconn 10 maxconn 200

frontend  managementAdPlatform 
    bind-process odd
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.8:10015
    bind X.X.X.221:80
    maxconn    50
    mode http
    default_backend Adplatform_mgmt
    timeout client 3600s

backend Adplatform_mgmt
    timeout server 3600s
    option  httpchk GET /keepalive
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor
    server web-10 X.X.X.19:8280  weight 50  check  inter  10s minconn 10 maxconn 25 slowstart 120s
    server web-12 X.X.X.52:8280  weight 50  check  inter  10s minconn 10 maxconn 25 slowstart 120s
    server web-13 X.X.X.53:8280  weight 50  check  inter  10s minconn 10 maxconn 25 slowstart 120s
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

frontend Public-HTTP
    bind-process odd
    	http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
        mode http
        bind X.X.X.155:80
        default_backend Web-Farm-HTTP

backend Web-Farm-HTTP
        mode http
        balance roundrobin
        option     http-server-close
        option     forwardfor
        server Web-2 X.X.X.72:80 check
        server Web-3 X.X.X.73:80 check backup

frontend Public-HTTPS
    bind-process even
        mode tcp
    	http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
        bind X.X.X.155:443 #ssl crt /etc/haproxy/ssl/developers.example.com.pem
        default_backend Web-Farm-SSL

backend Web-Farm-SSL
        mode tcp
        balance roundrobin
        option     http-server-close
        option     forwardfor
        server Web-2 X.X.X.72:80 check
        server Web-3 X.X.X.73:443 check backup


frontend portal-api-in
    bind-process odd
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.156:80
    acl is_api url_beg  /pub/report/1.0
    acl is_adv url_beg  /adv/report/1.0
    acl is_advcmp url_beg  /adv/campaign/1.0
    acl is_advcmps url_beg  /adv/campaigns/1.0
    use_backend api-nodes-3506 if is_api
    use_backend api-nodes if is_adv
    use_backend api-camp if is_advcmp
    use_backend api-camp if is_advcmps
    maxconn    50
    timeout client-fin 1s

backend api-nodes-3506
    option  httpchk GET /
    fullconn   5000
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor

    #server node-1 X.X.X.141:3506  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-2 X.X.X.142:3506  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-3 X.X.X.143:3506  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-4 X.X.X.144:3506  weight 50  check  inter  30s minconn 10 maxconn 25
    server node-5 X.X.X.95:3506  weight 50  check  inter  30s minconn 10 maxconn 25
    server node-6 X.X.X.96:3506  weight 50  check  inter  30s minconn 10 maxconn 25

backend api-nodes
    option  httpchk GET /infra/keepalive
    fullconn   5000
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor

    #server node-1 X.X.X.141:3000  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-2 X.X.X.142:3000  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-3 X.X.X.143:3000  weight 50  check  inter  30s minconn 10 maxconn 25
    #server node-4 X.X.X.144:3000  weight 50  check  inter  30s minconn 10 maxconn 25
    server node-5 X.X.X.95:3503  weight 50  check  inter  30s minconn 10 maxconn 25
    server node-6 X.X.X.96:3503  weight 50  check  inter  30s minconn 10 maxconn 25


#### Internal Access ####

listen apigw 
    bind X.X.X.8:10012
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /keepalive
    timeout queue  100ms
    maxconn    50
    balance    roundrobin

    server web-41 X.X.X.61:8380  weight 50  check  inter  10s minconn 10 maxconn 250
    server web-42 X.X.X.62:8380  weight 50  check  inter  10s minconn 10 maxconn 250
    server web-43 X.X.X.63:8380  weight 50  check  inter  10s minconn 10 maxconn 250
    server web-44 X.X.X.64:8380  weight 50  check  inter  10s minconn 10 maxconn 250


listen ProcAgent 
    bind X.X.X.8:9091
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /api
    timeout queue  100ms
    maxconn    50
    balance    roundrobin

    server sm1 X.X.X.20:9091  weight 50  check  inter  10s minconn 10 maxconn 25
    server ps2 X.X.X.192:9091  weight 50  check  inter  10s minconn 10 maxconn 25


listen Advertising 
    bind X.X.X.8:8680
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /Advertising/keepalive
    maxconn    50
    timeout server 1200s
    timeout connect 1200s
    option     abortonclose
    option     httpclose
    balance    roundrobin

    server web-10 X.X.X.19:8680  weight 50  check  inter  10s minconn 10 maxconn 25 rise 6 slowstart 120s
    server web-42 X.X.X.62:8680  weight 50  check  inter  10s minconn 10 maxconn 25 rise 6 slowstart 120s backup
    server web-41 X.X.X.61:8680  weight 50  check  inter  10s minconn 10 maxconn 25 rise 6 slowstart 120s backup


listen internalAppwallGW 
    bind X.X.X.8:10010
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /keepalive
    maxconn    50
    option     abortonclose
    option     httpclose
    balance    roundrobin
    cookie JSESSIONID prefix

    server web-41 X.X.X.61:8580  cookie F weight 50  check  inter  10s minconn 10 maxconn 250
    server web-42 X.X.X.62:8580  cookie G weight 50  check  inter  10s minconn 10 maxconn 250
    server web-43 X.X.X.63:8580  cookie H weight 50  check  inter  10s minconn 10 maxconn 250
    server web-44 X.X.X.64:8580  cookie I weight 50  check  inter  10s minconn 10 maxconn 250


listen alertManager 
    bind X.X.X.8:8980
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    option  httpchk GET /keepalive
    timeout server 3600s
    timeout connect 600s
    maxconn    50
    option     abortonclose
    option     httpclose
    balance    roundrobin

    server web-41 X.X.X.61:8980  weight 50  check  inter  10s minconn 10 maxconn 25
    server web-42 X.X.X.62:8980  weight 50  check  inter  10s minconn 10 maxconn 25
    server web-43 X.X.X.63:8980  weight 50  check  inter  10s minconn 10 maxconn 25
    server web-44 X.X.X.64:8980  weight 50  check  inter  10s minconn 10 maxconn 25


listen sync.example.com 
    bind X.X.X.8:10016
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    option     httpclose
    balance    roundrobin
    timeout server 3600s
    timeout connect 600s

    server IIS-STG sync.example.com:80  check


### KAFKA ###

listen kafka1 
    bind X.X.X.221:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl1 X.X.X.211:9092 check

listen kafka2 
    bind X.X.X.222:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl2 X.X.X.212:9092 check

listen kafka3 
    bind X.X.X.223:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl3 X.X.X.213:9092 check

listen kafka4 
    bind X.X.X.224:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl4 X.X.X.214:9092 check

listen kafka5 
    bind X.X.X.225:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl5 X.X.X.215:9092 check

listen kafka6 
    bind X.X.X.226:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl6 X.X.X.196:9092 check

listen kafka7 
    bind X.X.X.227:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl7 X.X.X.197:9092 check

listen kafka8
    bind X.X.X.228:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl8 X.X.X.198:9092 check

listen kafka9
    bind X.X.X.229:9092
    mode tcp
    bind-process even
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    maxconn    50
    option     abortonclose
    balance    roundrobin
    timeout server 86400s
    timeout client 86400s
    timeout connect 600s

    server xetl9 X.X.X.199:9092 check

frontend DataPlatform-API
    bind-process odd
    maxconn 1000
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.174:20220
    mode http
    default_backend SDP-API-HTTP


backend SDP-API-HTTP
    mode http
    option httpchk GET /keepAlive
    balance roundrobin
    option http-server-close
    option forwardfor
    server web-22 X.X.X.148:9000 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server web-23 X.X.X.149:9000 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server web-24 X.X.X.150:9000 weight 10 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server wls2   X.X.X.54:9000  weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server wls4   X.X.X.146:9000  weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1

frontend DataPlatform-API-Int
    bind-process odd
    maxconn 10000
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.189:80
    bind X.X.X.190:80
    bind X.X.X.223:80
    bind X.X.X.224:80
    bind X.X.X.8:80
    mode http
    default_backend SDP-API-HTTP-INT

backend SDP-API-HTTP-INT
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    fullconn 10000
    mode http
    option httpchk GET /keepAlive
    balance roundrobin
    option http-server-close
    option forwardfor
    server web-22 X.X.X.148:9000 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server web-23 X.X.X.149:9000 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server web-24 X.X.X.150:9000 weight 10 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server wls2   X.X.X.54:9000  weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1
    server wls4   X.X.X.146:9000  weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1

frontend DataPlatform-API-SSL
    bind-process even
    timeout client 86400000
    timeout http-request 60m
    bind-process even
    maxconn 10000
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.230:80
    bind X.X.X.230:443 ssl crt /etc/haproxy/ssl/api.somedata.com.pem
    redirect scheme https if !{ ssl_fc }
    mode http
    acl url_api path_beg /soda
    acl url_api_keepalive path_beg /keepAlive
    use_backend SDP-API-HTTP if url_api
    use_backend SDP-API-HTTP if url_api_keepalive

frontend Advertising-External-8008
    bind-process odd
    maxconn 50
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.174:8008
    mode http
    acl url_ext_advertising path_beg /Advertising/getAuthorizationCode
    use_backend Advertising-External-8680 if url_ext_advertising

backend Advertising-External-8680
    mode http
    option httpchk GET /Advertising/keepalive
    balance roundrobin
    option forwardfor

    server web-10 X.X.X.19:8680  weight 50  check  inter  10s minconn 50 maxconn 100 maxqueue 1
    server web-42 X.X.X.62:8680  weight 50  check  inter  10s minconn 50 maxconn 100 maxqueue 1 backup
    server web-41 X.X.X.61:8680  weight 50  check  inter  10s minconn 50 maxconn 100 maxqueue 1 backup

###### Test ######

frontend Test
    bind-process odd
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    bind X.X.X.174:8080
    acl do_not_redirect src 61.216.8.103 198.74.51.48 45.79.66.181 45.79.64.91 45.79.102.207 54.241.44.2 31.168.97.98
    redirect location http://lp.example.com/going-wild if !do_not_redirect
    maxconn    10000
    timeout client-fin 1s
    default_backend test


backend test
    balance    roundrobin
    option     abortonclose
    option     http-server-close
    option     forwardfor

    server node-1 X.X.X.75:80  weight 50  check  inter  30s minconn 20 maxconn 25

frontend portal-external-get
    bind-process even
    maxconn 50
    http-request set-log-level silent unless { path_beg -i /trackinstall } or { path_beg -i /trackpostinstall }
    timeout client 86400000
    timeout http-request 60m
    bind X.X.X.174:8001
    bind X.X.X.174:443 ssl crt /etc/haproxy/ssl/portal.example.com.pem
    #redirect scheme https if !{ ssl_fc }
    mode http
    default_backend nodes-internal-3504


backend api-camp
    mode http
    balance roundrobin
    option forwardfor
    cookie connect.sid prefix
    #server node-1 X.X.X.141:3503  cookie A weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    #server node-2 X.X.X.142:3503  cookie B weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    #server node-3 X.X.X.143:3503  cookie C weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    #server node-4 X.X.X.144:3503  cookie D weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-5 X.X.X.95:3503  cookie E weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    server node-6 X.X.X.96:3503  cookie F weight 50  check  inter  10s minconn 10 maxconn 25 maxqueue 1
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
