Hi, This was an undocumented feature which is inherited from very early ages of HAProxy: in a listen section (only), if a server has no service port configured (after its IP address) and checks are enabled on it, then HAProxy uses the port defined by the first bind line of the same section.
We decided to obsolete this feature, cause it's useless now and because it prevented a simple and reliable way to change the server port (patches on their way). It's a MAJOR change which might break some configurations. Baptiste
From 4ac38c5f2e22ff1294efbaabe9b632474924412d Mon Sep 17 00:00:00 2001 From: Baptiste Assmann <bed...@gmail.com> Date: Mon, 25 Apr 2016 13:40:51 +0200 Subject: [PATCH 03/11] MAJOR: listen section: don't use first bind port anymore when no server ports are provided Up to HAProxy 1.7, HAProxy used to use the first bind port from it's local 'listen' section when no port is configured on the server. IE, in the configuration below, the server port would be 25: listen smtp bind :25 server s1 1.0.0.1 check This way of working is now obsolete and can be removed, furthermore it is not documented! This will make the possibility to change the server's port much easier. --- src/server.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/server.c b/src/server.c index 39fc4db..62c08b0 100644 --- a/src/server.c +++ b/src/server.c @@ -1767,19 +1767,6 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr if (!newsrv->check.port) newsrv->check.port = realport; /* by default */ - if (!newsrv->check.port) { - /* not yet valid, because no port was set on - * the server either. We'll check if we have - * a known port on the first listener. - */ - struct listener *l; - - list_for_each_entry(l, &curproxy->conf.listeners, by_fe) { - newsrv->check.port = get_host_port(&l->addr); - if (newsrv->check.port) - break; - } - } /* * We need at least a service port, a check port or the first tcp-check rule must * be a 'connect' one when checking an IPv4/IPv6 server. -- 1.9.1