From: Aurelien DARRAGON Date: Wed, 6 Dec 2023 10:01:01 +0000 (+0100) Subject: MINOR: proxy: monitor-uri works with tcp->http upgrades X-Git-Tag: v3.0-dev1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e35fa36360fe8d877cdcf1c0910b6a1505d5f954;p=thirdparty%2Fhaproxy.git MINOR: proxy: monitor-uri works with tcp->http upgrades 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. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index f2fb4676ba..b27eb2aa34 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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); diff --git a/src/proxy.c b/src/proxy.c index 9beb232dae..905c320957 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -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;