Files
mtusi2026lab7/infra/haproxy/haproxy.cfg
T

52 lines
1.8 KiB
INI

global
log stdout format raw local0 info
maxconn 2000
ssl-default-bind-options ssl-min-ver TLSv1.2
ssl-default-server-options ssl-min-ver TLSv1.2
defaults
mode http
log global
log-format "%ci:%cp %ft %b/%s %ST %Tt"
option dontlognull
timeout connect 1s
timeout client 30s
timeout server 10s
timeout http-request 10s
timeout queue 5s
timeout check 1s
retries 2
option redispatch 1
retry-on conn-failure
unique-id-format %[uuid()]
http-error status 502 content-type application/json hdr X-Request-Id "%[unique-id]" lf-string "{\"error\":{\"code\":\"unavailable\",\"message\":\"bad gateway\",\"request_id\":\"%[unique-id]\"}}"
http-error status 503 content-type application/json hdr X-Request-Id "%[unique-id]" lf-string "{\"error\":{\"code\":\"unavailable\",\"message\":\"no API replica available\",\"request_id\":\"%[unique-id]\"}}"
http-error status 504 content-type application/json hdr X-Request-Id "%[unique-id]" lf-string "{\"error\":{\"code\":\"unavailable\",\"message\":\"gateway timeout\",\"request_id\":\"%[unique-id]\"}}"
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 5s
hold obsolete 5s
accepted_payload_size 8192
frontend public
bind :8443 ssl crt /run/tls/ingress.pem
default_backend api
frontend local-health
bind 127.0.0.1:8404
no log
http-request return status 200 if { nbsrv(api) gt 0 }
http-request return status 503
backend api
balance roundrobin
http-request set-timeout server 60s if { method POST } { path_reg ^/api/v1/chats/[^/]+/attachments$ }
option httpchk GET /health/core
http-check expect status 200
default-server check inter 1s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none
server-template api 1-4 api:8080 ssl ca-file /run/tls/ca.crt verify required verifyhost api sni str(api) check-sni api crt /run/tls/client.pem