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.
This commit is contained in:
Christopher Faulet 2021-03-31 17:13:49 +02:00
parent 3b6446f4d9
commit 5eef0189c7
1 changed files with 8 additions and 0 deletions

View File

@ -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) { if (curproxy->table && curproxy->table->peers.name) {
struct peers *curpeers; struct peers *curpeers;