]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: server: lookup defaults section on "from be:"
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 23 Nov 2026 13:22:54 +0000 (14:22 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 23 Nov 2026 13:54:31 +0000 (14:54 +0100)
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.

doc/configuration.txt
src/server.c

index 7065b72a040f01214e9513ce92a91f3fe09de12e..b69e68c61ce9874c825b2ae219527e9d992f34d8 100644 (file)
@@ -19319,6 +19319,8 @@ from <origin>
       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:[<bename>/]<srvname>
       instructs to reuse the settings from the designated backend's server or
       named default-server resulting from the processing of all its
index 4129e8223c4f72a829313032a78e1747f2809443..c67c15886ad8b9d5cdbb49a14fdb5f87f1ca38ef 100644 (file)
@@ -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;