From: Amaury Denoyelle Date: Mon, 23 Nov 2026 13:22:54 +0000 (+0100) Subject: MINOR: server: lookup defaults section on "from be:" X-Git-Url: https://git.kaiwu.me/http/control.html?a=commitdiff_plain;h=cddcc51e6c1b446accb88b2cd237f654f0366523;p=haproxy.git MINOR: server: lookup defaults section on "from be:" This patch is similar to the previous one. As an alternative to a backend name, "from be:" may now also reference a named defaults section to reuse its unnamed default-server. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 7065b72a0..b69e68c61 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -19319,6 +19319,8 @@ from behavior for servers defined in the configuration file. This empty value is mostly useful for dynamic servers created on the CLI which by default ignore any default-server, which is equivalent to the "none" value. + Alternatively, a named defaults section can also be used as an argument + to reuse its unnamed default-server. - srv:[/] instructs to reuse the settings from the designated backend's server or named default-server resulting from the processing of all its diff --git a/src/server.c b/src/server.c index 4129e8223..c67c15886 100644 --- a/src/server.c +++ b/src/server.c @@ -4123,8 +4123,10 @@ static int _srv_parse_from(struct server *srv, char **args, int *cur_arg, if (istlen(be_name)) { px = proxy_be_by_name(istptr(be_name)); + if (!px) + px = proxy_find_by_name(istptr(be_name), PR_CAP_DEF, 0); if (!px) { - ha_alert("from: unknown backend instance '%s'.\n", + ha_alert("from: unknown backend or defaults instance '%s'.\n", istptr(be_name)); err_code = ERR_ALERT | ERR_FATAL; goto out;