]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: cfgparse: turn the same proxy name warning to an error
authorWilly Tarreau <w@1wt.eu>
Mon, 23 Jun 2025 13:26:44 +0000 (15:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 23 Jun 2025 13:34:05 +0000 (15:34 +0200)
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.

doc/configuration.txt
src/cfgparse-listen.c

index 77d309de4433d7c9cf0bc02e9bf95fa8f1870425..74cd880985e65abca75cf14e9713989d6d1e1480 100644 (file)
@@ -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
index 2dd2a489735bcc3acefe3882dd27f15d74e7ea79..31a9111019d397aba1291e399a77ec3c4843f73e 100644 (file)
@@ -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]) {