From: Christopher Faulet Date: Wed, 31 Mar 2021 15:13:49 +0000 (+0200) Subject: MINOR: config/proxy: Warn if a TCP proxy without backend is upgradable to HTTP X-Git-Tag: v2.4-dev15~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eef0189c76ac7e7a6e02c590cf7c348e3535fb2;p=thirdparty%2Fhaproxy.git MINOR: config/proxy: Warn if a TCP proxy without backend is upgradable to HTTP If a 'switch-mode http' tcp action is configured on a listener with no backend, a warning is displayed to remember HTTP connections cannot be routed to TCP servers. Indeed, backend connection is still established using the proxy mode. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 7f82409ed9..6f8522e41e 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2554,6 +2554,14 @@ int check_config_validity() } } + /* Warn is a switch-mode http is used on a TCP listener with servers but no backend */ + if (!curproxy->defbe.name && LIST_ISEMPTY(&curproxy->switching_rules) && curproxy->srv) { + if ((curproxy->options & PR_O_HTTP_UPG) && curproxy->mode == PR_MODE_TCP) + ha_warning("Proxy '%s' : 'switch-mode http' configured for a %s %s with no backend. " + "Incoming connections upgraded to HTTP cannot be routed to TCP servers\n", + curproxy->id, proxy_mode_str(curproxy->mode), proxy_type_str(curproxy)); + } + if (curproxy->table && curproxy->table->peers.name) { struct peers *curpeers;