]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: emit a warning when 'default_backend' masks servers
authorWilly Tarreau <w@1wt.eu>
Mon, 13 Feb 2012 13:32:34 +0000 (14:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 13 Feb 2012 13:32:34 +0000 (14:32 +0100)
When a "listen" instance uses a "default_backned" rule and has servers,
the servers will never be used. Report it so that users don't get trapped.

src/cfgparse.c

index 815ffff7faf44f15d6e6fc0e20ba8c5ee4822090..77f0c5d81d9f46a585edbe6bf8e10b3a10ba27ab 100644 (file)
@@ -5723,6 +5723,13 @@ int check_config_validity()
                                 */
                                target->bind_proc = curproxy->bind_proc ?
                                        (target->bind_proc | curproxy->bind_proc) : 0;
+
+                               /* Emit a warning if this proxy also has some servers */
+                               if (curproxy->srv) {
+                                       Warning("In proxy '%s', the 'default_backend' rule always has precedence over the servers, which will never be used.\n",
+                                               curproxy->id);
+                                       err_code |= ERR_WARN;
+                               }
                        }
                }