From: Willy Tarreau Date: Mon, 23 Jun 2025 13:26:44 +0000 (+0200) Subject: MAJOR: cfgparse: turn the same proxy name warning to an error X-Git-Tag: v3.3-dev2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=067be38c0ee18a993a51541179296b45c59d6a31;p=thirdparty%2Fhaproxy.git MAJOR: cfgparse: turn the same proxy name warning to an error As warned since 3.1, it's no longer permitted to have a frontend and a backend under the same name. This causes too many designation issues, and causes trouble with stick-tables as well. Now each proxy name is unique. This commit only changes the check to return an error. Some code parts currently exist to find the best candidates, these will be able to be simplified as future cleanup patches. The doc was updated. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 77d309de4..74cd88098 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5345,11 +5345,11 @@ All proxy names must be formed from upper and lower case letters, digits, '-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are case-sensitive, which means that "www" and "WWW" are two different proxies. -Historically, all proxy names could overlap, it just caused troubles in the -logs. Since the introduction of content switching, it is mandatory that two -proxies with overlapping capabilities (frontend/backend) have different names. -However, it is still permitted that a frontend and a backend share the same -name, as this configuration seems to be commonly encountered. +Historically, all proxy names could overlap when certain conditions were met +(e.g. when not having the same frontend/backend capabilities), but it used to +cause too many problems in the logs as well as confusion on CLI operations, +stick-tables naming and stats retrieval. It is now mandatory that two proxies +have different names, regardless of their respective capabilities. Right now, two major proxy modes are supported : "tcp", also known as layer 4, and "http", also known as layer 7. In layer 4 mode, HAProxy simply forwards diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 2dd2a4897..31a911101 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -424,11 +424,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) if (curproxy) { /* different capabilities but still same name: forbidden soon */ - ha_warning("Parsing [%s:%d]: %s '%s' has the same name as %s '%s' declared at %s:%d." - " This is dangerous and will not be supported anymore in version 3.3.\n", + ha_alert("Parsing [%s:%d]: %s '%s' has the same name as %s '%s' declared at %s:%d." + " This is no longer supported as of 3.3. Please rename one or the other.\n", file, linenum, proxy_cap_str(rc), args[1], proxy_type_str(curproxy), curproxy->id, curproxy->conf.file, curproxy->conf.line); - err_code |= ERR_WARN; + err_code |= ERR_ALERT | ERR_ABORT; + goto out; } if (rc & PR_CAP_DEF && strcmp(args[1], "from") == 0 && *args[2] && !*args[3]) {