]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: monitor-uri works with tcp->http upgrades
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 6 Dec 2023 10:01:01 +0000 (11:01 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Dec 2023 13:22:26 +0000 (14:22 +0100)
Currently, we have a check in proxy_cfg_ensure_no_http() that generates a
warning if the monitor-uri is configured on a proxy that doesn't have
mode HTTP enabled.

However, when we give a look at monitor-uri implementation, it's not
100% correct. Indeed, despite the warning message, the directive will
still be evaluated when HTTP upgrade occurs from a TCP frontend.
Thus the error is misleading.

To make the error message comply with the actual behavior, the check was
moved alongside other checks that accept both native HTTP mode or HTTP
upgrades in cfgparse.c.

src/cfgparse.c
src/proxy.c

index f2fb4676bad16bc73f939d22c9af98502b9ecae4..b27eb2aa34fcba2064273fd6fd045749b487481a 100644 (file)
@@ -3815,6 +3815,12 @@ out_uri_auth_compat:
                                err_code |= ERR_WARN;
                        }
 
+                       if (isttest(curproxy->monitor_uri)) {
+                               ha_warning("'monitor-uri' statement ignored for %s '%s' as it requires HTTP mode.\n",
+                                          proxy_type_str(curproxy), curproxy->id);
+                               err_code |= ERR_WARN;
+                       }
+
                        if (!LIST_ISEMPTY(&curproxy->http_req_rules)) {
                                ha_warning("'http-request' rules ignored for %s '%s' as they require HTTP mode.\n",
                                           proxy_type_str(curproxy), curproxy->id);
index 9beb232dae56596107a8a7a0f03b6d4f28f98698..905c320957bf0e8fe53b02645cb3148e196195bd 100644 (file)
@@ -1329,10 +1329,6 @@ int proxy_cfg_ensure_no_http(struct proxy *curproxy)
                ha_warning("cookie will be ignored for %s '%s' (needs 'mode http').\n",
                           proxy_type_str(curproxy), curproxy->id);
        }
-       if (isttest(curproxy->monitor_uri)) {
-               ha_warning("monitor-uri will be ignored for %s '%s' (needs 'mode http').\n",
-                          proxy_type_str(curproxy), curproxy->id);
-       }
        if (curproxy->lbprm.algo & BE_LB_NEED_HTTP) {
                curproxy->lbprm.algo &= ~BE_LB_ALGO;
                curproxy->lbprm.algo |= BE_LB_ALGO_RR;