forked from mtusi2026/mtusi2026lab7
49 lines
2.2 KiB
INI
49 lines
2.2 KiB
INI
global
|
|
log stdout format raw local0
|
|
maxconn 256
|
|
|
|
defaults
|
|
mode http
|
|
log global
|
|
timeout connect 1s
|
|
timeout client 60s
|
|
timeout server 60s
|
|
timeout check 3s
|
|
retries 0
|
|
http-error status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"API temporarily unavailable","request_id":"%[unique-id]"}}' hdr X-Request-Id %[unique-id] hdr X-Instance-Id lb
|
|
|
|
resolvers docker
|
|
nameserver local 127.0.0.11:53
|
|
resolve_retries 2
|
|
timeout resolve 1s
|
|
timeout retry 1s
|
|
hold valid 1s
|
|
hold nx 1s
|
|
hold obsolete 1s
|
|
|
|
frontend public
|
|
bind :8443 ssl crt /run/server/bundle.pem ssl-min-ver TLSv1.2
|
|
unique-id-format %[uuid()]
|
|
stick-table type ip size 100k expire 10s store http_req_rate(1s)
|
|
http-request set-header X-Forwarded-For %[src]
|
|
http-request track-sc0 src if { path /api/v1/auth/sessions } METH_POST
|
|
http-request return status 429 content-type application/json lf-string '{"error":{"code":"rate_limited","message":"Too many logins","request_id":"%[unique-id]"}}' hdr Retry-After 1 hdr X-Request-Id %[unique-id] hdr X-Instance-Id lb if { path /api/v1/auth/sessions } METH_POST { sc_http_req_rate(0) gt 20 }
|
|
use_backend api_live if { path /health/live }
|
|
default_backend api_ready
|
|
|
|
backend api_ready
|
|
balance roundrobin
|
|
option httpchk GET /health/ready
|
|
http-check expect status 200
|
|
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none
|
|
server first api1:8443 check ssl verify required ca-file /run/pki/ca.crt crt /run/identity/bundle.pem verifyhost api1 sni str(api1) check-sni api1
|
|
server second api2:8443 check ssl verify required ca-file /run/pki/ca.crt crt /run/identity/bundle.pem verifyhost api2 sni str(api2) check-sni api2
|
|
|
|
backend api_live
|
|
balance roundrobin
|
|
option httpchk GET /health/live
|
|
http-check expect status 200
|
|
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none
|
|
server first api1:8443 check ssl verify required ca-file /run/pki/ca.crt crt /run/identity/bundle.pem verifyhost api1 sni str(api1) check-sni api1
|
|
server second api2:8443 check ssl verify required ca-file /run/pki/ca.crt crt /run/identity/bundle.pem verifyhost api2 sni str(api2) check-sni api2
|