Files
mtusi2026lab4/infra/haproxy/haproxy.cfg
T

44 lines
1.4 KiB
INI

global
log stdout format raw local0 info
maxconn 2000
defaults
mode http
log global
option httplog
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 :8080
default_backend api
backend api
balance roundrobin
http-request set-timeout server 60s if { method POST } { path_reg ^/api/v1/chats/[^/]+/attachments$ }
option httpchk GET /health/ready
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