Keep liveness reachable through mTLS when dependency readiness fails

This commit is contained in:
2026-11-16 12:07:47 +03:00
parent cc1c31c196
commit ca6fbae108
+12 -1
View File
@@ -27,7 +27,9 @@ resolvers docker
frontend public
bind :8443 ssl crt /run/tls/identity/combined.pem
http-request set-var(txn.lb_request_id) uuid()
http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No ready API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' if { nbsrv(apis) eq 0 }
http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No ready API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { nbsrv(apis) eq 0 } !{ path /health/live }
http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No live API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { path /health/live } { nbsrv(live_apis) eq 0 }
use_backend live_apis if { path /health/live }
default_backend apis
backend apis
@@ -36,3 +38,12 @@ backend apis
http-check expect status 200
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2
server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none
# Liveness remains observable when a dependency seals and readiness is false.
# This backend exposes only the exact liveness path, still through LB mTLS.
backend live_apis
balance roundrobin
option httpchk GET /health/live
http-check expect status 200
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2
server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none