Note: HAProxy running as a POD in k8s environment.
global
log stdout format raw local0 info
maxconn 40000
stats socket /var/run/haproxy-ssl.stat
tune.h2.initial-window-size 2000000
ca-base /opt/haproxy/ssl/ca/
tune.ssl.default-dh-param 2048
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option forwardfor except 127.0.0.0/8
option dontlognull
option httplog
balance roundrobin
retries 3
maxconn 40000
timeout http-keep-alive 60s
timeout client 10m
timeout server 10m
timeout queue 1m
timeout connect 10s
timeout check 10s
timeout http-request 10s
default-server init-addr last,libc,none
errorfile 503 /opt/haproxy/errors/503.html
errorfile 400 /opt/haproxy/errors/400.html
errorfile 403 /opt/haproxy/errors/403.html
errorfile 500 /opt/haproxy/errors/500.html
errorfile 502 /opt/haproxy/errors/502.html
errorfile 504 /opt/haproxy/errors/504.html
errorfile 408 /dev/null
frontend keepalived-monitor
mode http
bind *:8080
monitor-uri /____rp-health.html
monitor fail if { nbsrv(apache_ping) lt 1 }
frontend “$HAPROXY_NODE”
mode http
bind *:80 accept-proxy
bind *:443 accept-proxy ssl no-tlsv10 no-tlsv11 crt /usr/local/etc/haproxy/ssl/certs ca-file /usr/local/etc/haproxy/ssl/usercerts/client-ts verify optional alpn h2,http/1.1 crt-ignore-err all
bind *:8443 ssl no-tlsv10 no-tlsv11 crt /usr/local/etc/haproxy/ssl/certs ca-file /usr/local/etc/haproxy/ssl/usercerts/client-ts verify optional alpn h2,http/1.1 crt-ignore-err all
monitor-uri /____rp-proxy.html
log-format “%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r %sslc %sslv”
unique-id-format %{+X}o\ %ci:%cp_%fi:%fp_%Ts_%rt:%pid
unique-id-header X-Unique-ID
Modify request and response headers
http-request set-header X-Client-Certificate %[ssl_c_der,base64]
http-request add-header X-Forwarded-Proto https
http-request add-header X-Forwarded-Port 443
http-response add-header X-RP-SSL-Name “$HAPROXY_NODE”
http-response del-header ^Server:.*
http-response del-header ^X-Powered-By:.*
http-response del-header ^X-Runtime:.*
http-response del-header ^X-SSO:.*
capture request header Host len 128
capture request header Referer len 256
capture request header User-Agent len 256
capture request header X-Unique-ID len 64
capture response header AUTH_USER len 64
capture response header JSESSIONID len 64
capture request header X-Forwarded-For len 64
#Redirect routes from 80 to 443 (in case they try to come in on http://)
redirect scheme https code 308 if !{ ssl_fc }
http-response set-header Strict-Transport-Security “max-age=31536000; includeSubDomains; preload;”
use_backend stats_backend if { path -i /____rp-stats }
use_backend stats_backend if { path -i /____rp-metrics }
default_backend apache_ping
resolvers dns
parse-resolv-conf
hold valid 10s
backend apache_ping
option httpchk
http-check send ver HTTP/1.1 meth GET hdr Host uri /____ping_proxy_healthz_check.html
http-check expect status 200
default-server maxconn 3200 inter 2s fall 3 rise 2
server-template apache-ping 6 xxxx.svc.cluster.local:444 check resolvers ssl verify none
frontend stats
bind *:8000
option http-use-htx
http-request use-service prometheus-exporter if { path /____rp-metrics }
stats enable
stats uri /____rp-stats
stats auth xxxx:xxxx
stats refresh 10s
backend stats_backend
server stats 127.0.0.1:8000 verify none