fix(haproxy): Validate backend names, reject IP:port misconfiguration

Add validation in _add_vhost_acl() to detect when vhost backend
is set to IP:port format instead of a proper backend name.

This prevents haproxy config generation errors like:
  [ALERT] unable to find required use_backend: '127.0.0.1:8081'

When detected, logs a warning and skips the vhost instead of
generating invalid config that crashes HAProxy.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-06 22:30:38 +01:00
parent 3e2101725e
commit e25509cb90

View File

@ -553,6 +553,10 @@ _add_vhost_acl() {
config_get domain "$section" domain
config_get backend "$section" backend
# Validate backend is not IP:port (common misconfiguration)
case "$backend" in
*:*) log_warn "Vhost $section has IP:port backend , should be backend name"; return ;;
esac
config_get ssl "$section" ssl "0"
[ -n "$domain" ] || return