aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/haproxy-dev/haproxy.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/config/haproxy-dev/haproxy.inc b/config/haproxy-dev/haproxy.inc
index ba39e5c9..b5f62c4f 100644
--- a/config/haproxy-dev/haproxy.inc
+++ b/config/haproxy-dev/haproxy.inc
@@ -271,8 +271,15 @@ function haproxy_configure() {
$checkinter = "check inter 1000";
$a_servers = &$pool['ha_servers']['item'];
foreach($a_servers as $be) {
- if(!$be['port'])
+ if(!$be['port']) {
+ // the listener can specify a default port
$be['port'] = $backend['svrport'];
+ }
+ if(!$be['port']) {
+ // last resort, use the frontend port
+ $ports = split(",", "{$backend['port']},");
+ $be['port'] = $ports[0];
+ }
if (!$be['name'])
$be['name'] = $be['address'];
fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter weight " . $be['weight'] . "{$advanced_txt}\n");