aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@pfSense.org>2013-08-05 10:51:33 -0700
committerRenato Botelho <garga@pfSense.org>2013-08-05 10:51:33 -0700
commitd63a1616cb40dc1db3c8d78101c4a45fdb1c8caf (patch)
treee2dfa14b7d659dac466ffc560f7d04280fc7f10b /config/haproxy-devel/haproxy.inc
parentd88e8e657a759c8f79fecf3a54d54b8225520b08 (diff)
parent5384c5f8d643d5a38e2a2b6c09cd539df39dc531 (diff)
downloadpfsense-packages-d63a1616cb40dc1db3c8d78101c4a45fdb1c8caf.tar.gz
pfsense-packages-d63a1616cb40dc1db3c8d78101c4a45fdb1c8caf.tar.bz2
pfsense-packages-d63a1616cb40dc1db3c8d78101c4a45fdb1c8caf.zip
Merge pull request #472 from PiBa-NL/HAProxy-devel-defaultbackend
HAProxy-devel defaultbackend selection, frontend grouping, skip inactive, variable naming
Diffstat (limited to 'config/haproxy-devel/haproxy.inc')
-rw-r--r--config/haproxy-devel/haproxy.inc11
1 files changed, 6 insertions, 5 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index f871ddd7..f8434327 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -486,7 +486,7 @@ function write_backend($fd, $name, $pool, $frontend) {
if (is_array($a_servers))
{
foreach($a_servers as $be) {
- if (!$be['status'] == "inactive")
+ if ($be['status'] == "inactive")
continue;
if (!$be['name'])
@@ -728,7 +728,7 @@ function haproxy_writeconf($configfile) {
// Combine the rest of the listener configs
- $default_once = 0;
+ $default_backend = "";
$i = 0;
foreach ($bind['config'] as $bconfig) {
$a_acl=&$bconfig['ha_acls']['item'];
@@ -742,9 +742,8 @@ function haproxy_writeconf($configfile) {
$poolname .= "_" . $bconfig['svrport'];
// Write this out once, and must be before any backend config text
- if ($default_once == 0) {
- fwrite ($fd, "\tdefault_backend\t\t" . $poolname . "\n");
- $default_once++;
+ if ($default_backend = "" || $bconfig['secondary'] != 'yes') {
+ $default_backend = $poolname;
}
if (!isset($a_pendingpl[$poolname])) {
@@ -790,6 +789,8 @@ function haproxy_writeconf($configfile) {
fwrite ($fd, "\tuse_backend\t\t" . $poolname . " if " . $aclnames . "\n");
}
}
+ fwrite ($fd, "\tdefault_backend\t\t" . $default_backend . "\n");
+
foreach($advancedextra as $extra)
fwrite ($fd, "\t".$extra."\n");
fwrite ($fd, "\n");