Up to HAProxy 1.7-dev3, 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.
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.