]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: warn when expose-experimental-directives is used for no reason
authorWilly Tarreau <w@1wt.eu>
Fri, 17 Oct 2025 16:15:12 +0000 (18:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 Oct 2025 17:00:21 +0000 (19:00 +0200)
If users start to enable expose-experimental-directives for the purpose
of testing one specific feature, there are chances that the option remains
forever and hides the experimental status of other options.

Let's emit a warning if the option appears and is not used. This will
remind users that they can now drop it, and help keep configs safe for
future upgrades.

doc/configuration.txt
src/cfgparse.c

index 2d169fd27cf2e210e189c683e48cc625871db60d..c0645848456bf9b635e30373f242b3c4388d76ce 100644 (file)
@@ -2464,7 +2464,10 @@ expose-experimental-directives
   breaking them but with no guarantee. For these reasons, these features are
   not expected to be supported beyond the release of the next LTS release.
   Users who want to try experimental features are expected to upgrade quickly
-  to benefit from the improvements made to that feature.
+  to benefit from the improvements made to that feature. In order to know if
+  this directive is still needed, it's easy: if it is enabled without being
+  used by any such feature, a warning will be emitted suggesting to turn it
+  off. So without any warning, it means it's still needed.
 
 external-check [preserve-env]
   Allows the use of an external agent to perform health checks. This is
index 288502b61cdd222c3af2161de1e70f0057e3b232..a36e88983d2b894929c20e0ed72b1afffb6e9d61 100644 (file)
@@ -4609,6 +4609,14 @@ init_proxies_list_stage2:
                        cfgerr += postparser->func();
        }
 
+       if (experimental_directives_allowed &&
+           !(get_tainted() & TAINTED_CONFIG_EXP_KW_DECLARED)) {
+               ha_warning("Option 'expose-experimental-directives' is set in the global section but is "
+                          "no longer used. It is strongly recommended to remove it in order to avoid "
+                          "using an experimental directive by accident in the future.\n");
+               err_code |= ERR_WARN;
+       }
+
        if (cfgerr > 0)
                err_code |= ERR_ALERT | ERR_FATAL;
  out: