Files
mtusi2026lab7-fork/infra/haproxy.cfg
T

43 lines
1.3 KiB
INI

global
# Operator access only inside this container; no host port is published.
stats socket ipv4@127.0.0.1:9999 level admin
log stdout format raw local0
maxconn 1024
defaults
log global
mode http
option httplog
timeout connect 1s
timeout client 35s
timeout server 35s
timeout check 1s
# Let the client decide which failed POST is safe to repeat.
retries 0
# Docker returns the current addresses of all containers of the api service.
resolvers docker
nameserver docker_dns 127.0.0.11:53
accepted_payload_size 8192
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 1s
hold obsolete 1s
hold nx 1s
hold timeout 1s
hold refused 1s
hold other 1s
frontend api_entry
bind :8443 ssl crt /run/tls/ingress.pem ssl-min-ver TLSv1.2
http-request set-header X-Forwarded-For %[src]
default_backend api_replicas
backend api_replicas
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
# Separate slots receive distinct Docker DNS addresses. No sticky sessions.
server-template api "${API_REPLICAS}" "api:${APP_PORT}" ssl verify required ca-file /run/tls/ca.crt crt /run/tls/lb.pem verifyhost api ssl-min-ver TLSv1.2 check inter 1s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr libc,none