]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: proxy: pass PR_FL_DEF_EXPLICIT_MODE through cascaded defaults
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2026 08:47:32 +0000 (10:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2026 08:47:32 +0000 (10:47 +0200)
Basha Mougamadou reported that in the following setup:

   defaults http
      mode http
      timeout client 10s
      timeout server 10s

   defaults fast-http from http
      timeout server 1s

Trying to add a backend using "from fast-http" would be rejected because
the "fast-http" section has no explicit "mode" directive. This is indeed
true, but not correct in that it is inherited from the "http" section
where it is explicit, so there it must be considered as explicit as well.
The reason is that the flag PR_FL_DEF_EXPLICIT_MODE is not inherited from
defaults sections in proxy_defproxy_cpy(). Let's just add it to the set
of such inherited flags to fix the problem.

This must be backported to 3.4.

src/proxy.c

index 3d88342223210a2a29d8397139fd7af79eed52c7..b9efedaffe75d450d26ea4f4eca5dee13bf672c0 100644 (file)
@@ -3343,7 +3343,7 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro
                srv_settings_cpy(curproxy->defsrv, defproxy->defsrv, 0);
        }
 
-       curproxy->flags = (defproxy->flags & PR_FL_DISABLED); /* Only inherit from disabled flag */
+       curproxy->flags = (defproxy->flags & (PR_FL_DISABLED | PR_FL_DEF_EXPLICIT_MODE)); /* Only inherit disabled + explicit_mode flags */
        curproxy->options = defproxy->options;
        curproxy->options2 = defproxy->options2;
        curproxy->no_options = defproxy->no_options;