Files
haproxy-manager-base/templates/hap_suspended_backend.tpl
Josh Knapp 6fd07b4c54
All checks were successful
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 52s
fix(suspended): tolerate startup DNS failure + use docker_dns resolvers
If the upstream container isn't up when haproxy-manager starts (e.g. when
haproxy is recreated before whp-suspended), the default `init-addr libc` mode
makes haproxy refuse to start — taking down the whole proxy. Switched to
`init-addr last,none` (use last known address, fall back to 0.0.0.0 = DOWN)
and added `resolvers docker_dns` (defined in hap_header.tpl) so the real IP
is picked up once DNS becomes resolvable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:52:50 -07:00

19 lines
1.0 KiB
Smarty

# Suspended-site backend. Used when external tooling adds a host to
# /etc/haproxy/suspended_domains.list (read by an ACL in the frontend).
# The backend points at a single upstream that serves a static 503
# "site temporarily unavailable" page. Only rendered when the
# HAPROXY_SUSPENSION_BACKEND env var is set on the haproxy-manager
# container; non-WHP deployments (home networks, standalone use) see
# no change to haproxy.cfg.
backend bk_suspended
mode http
option http-server-close
http-request set-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Forwarded-For %[src]
# init-addr last,none: tolerate startup-time DNS resolution failure
# (the upstream container may not be up yet when haproxy-manager starts).
# resolvers docker_dns: re-resolve via Docker's embedded DNS at 127.0.0.11
# so the server picks up the real IP once the upstream becomes available
# (the docker_dns block is defined in hap_header.tpl).
server suspended {{ target }} check inter 30s init-addr last,none resolvers docker_dns