From e35fa36360fe8d877cdcf1c0910b6a1505d5f954 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Wed, 6 Dec 2023 11:01:01 +0100 Subject: [PATCH] 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. --- src/cfgparse.c | 6 ++++++ src/proxy.c | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) 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; -- 2.47.2