aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2013-03-14 23:18:41 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2013-03-14 23:18:41 +0100
commit6074075ce90404997f21f5019c743ce599a1c3fc (patch)
treed07550651fe068e8f90966eea8250961883ef85c
parente1a963c1f543873630b104d244151ed70c0b9da7 (diff)
downloadpfsense-packages-6074075ce90404997f21f5019c743ce599a1c3fc.tar.gz
pfsense-packages-6074075ce90404997f21f5019c743ce599a1c3fc.tar.bz2
pfsense-packages-6074075ce90404997f21f5019c743ce599a1c3fc.zip
haproxy-devel, made frontend merging in such a way that it is more obvious that a lot of settings are not needed for 'secondary' frontends.
-rw-r--r--config/haproxy-devel/haproxy.inc138
-rw-r--r--config/haproxy-devel/haproxy_listeners.php168
-rw-r--r--config/haproxy-devel/haproxy_listeners_edit.php91
-rw-r--r--config/haproxy-devel/haproxy_pool_edit.php2
4 files changed, 287 insertions, 112 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index e246b8e0..a03bf219 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -348,9 +348,12 @@ function write_backend($fd, $name, $pool, $frontend) {
$httpchk = "ssl-hello-chk";
} else {
$backend_type = $frontend['type'];
- $httpchk = "httpchk";
+ if(strtolower($frontend['type']) == "http")
+ $httpchk = "httpchk";
+ else
+ unset($httpchk);
}
-
+
fwrite ($fd, "\tmode\t\t\t" . $backend_type . "\n");
if($pool['balance'])
@@ -392,7 +395,7 @@ function write_backend($fd, $name, $pool, $frontend) {
else
$uri = "/";
- if (!$sslserverpresent)
+ if ($httpchk)
fwrite ($fd, "\toption\t\t\t{$httpchk} HEAD " . $uri . " HTTP/1.0\n");
if ($pool['advanced_backend']) {
@@ -451,7 +454,7 @@ function haproxy_configure() {
function haproxy_check_writtenconfig_error() {
$configcheckoutput = shell_exec("haproxy -c -V -f /var/etc/haproxy.cfg 2>&1");
if (!strstr($configcheckoutput, "Configuration file is valid"))
- return $configcheckoutput;
+ return str_replace("\n","<br/>\n", $configcheckoutput);
else
return false;
}
@@ -528,12 +531,16 @@ function haproxy_writeconf() {
$b = &$a_bind[$bname];
// Overwrite ?
- $b['type'] = $backend['type'];
- $b['forwardfor'] = $backend['forwardfor'];
- $b['httpclose'] = $backend['httpclose'];
- $b['max_connections'] = $backend['max_connections'];
- $b['client_timeout'] = $backend['client_timeout'];
- $b['advanced'] = $backend['advanced'];
+ if ($backend['secondary'] != 'yes') {
+ if (isset($b['type']))
+ $input_errors[] = "Multiple primary frondends for $bname";
+ $b['type'] = $backend['type'];
+ $b['forwardfor'] = $backend['forwardfor'];
+ $b['httpclose'] = $backend['httpclose'];
+ $b['max_connections'] = $backend['max_connections'];
+ $b['client_timeout'] = $backend['client_timeout'];
+ $b['advanced'] = $backend['advanced'];
+ }
if ($ssl_crt != "") {
if ($b['ssl_info'] == "")
@@ -585,14 +592,12 @@ function haproxy_writeconf() {
$advanced = base64_decode($bind['advanced']);
fwrite($fd, "\t" . $advanced . "\n");
}
-
+
// https is an alias for tcp for clarity purpouses
if(strtolower($bind['type']) == "https") {
$backend_type = "tcp";
- $httpchk = "ssl-hello-chk";
- } else {
+ } else {
$backend_type = $bind['type'];
- $httpchk = "httpchk";
}
fwrite ($fd, "\tmode\t\t\t" . $backend_type . "\n");
@@ -711,6 +716,9 @@ function haproxy_writeconf() {
// create config file
fclose($fd);
+ if ($input_errors)
+ print_input_errors($input_errors);
+
if (isset($a_global['carpdev']))
haproxy_install_cron(true);
else
@@ -881,4 +889,106 @@ function haproxy_do_xmlrpc_sync($sync_to_ip, $password) {
}
}
+function get_frontend_id($name) {
+ global $a_backend;
+ $i = 0;
+ foreach($a_backend as $backend)
+ {
+ if ($backend['name'] == $name)
+ return $i;
+ $i++;
+ }
+ return null;
+}
+
+function get_frontend_ipport($fontend) {
+ global $a_backend;
+ if ($fontend['secondary'] == 'yes')
+ $mainfontend = $a_backend[get_frontend_id($fontend['primary_frontend'])];
+ else
+ $mainfontend = $fontend;
+ if($mainfontend['extaddr'] == "any")
+ $result = "0.0.0.0";
+ elseif($mainfontend['extaddr'])
+ $result = $mainfontend['extaddr'];
+ else
+ $result = get_current_wan_address('wan');
+ return $result . ":" . $mainfontend['port'];
+ return 'abc';
+}
+
+function haproxy_check_config() {
+ global $config;
+ $a_backends = &$config['installedpackages']['haproxy']['ha_backends']['item'];
+ $result = false;
+ $activefrontends = array();
+ $issues = array();
+
+ foreach($a_backends as $frontend) {
+ if (($frontend['status'] != 'active') || ($frontend['secondary'] == 'yes'))
+ continue;
+ $ipport = get_frontend_ipport($frontend);
+ if (isset($activefrontends[$ipport]))
+ $issues['P_'.$ipport] = "Multiple primary frontends with IP:Port \"$ipport\"";
+ else
+ $activefrontends[$ipport] = true;
+ }
+ foreach($a_backends as $frontend) {
+ if (($frontend['status'] != 'active') || ($frontend['secondary'] != 'yes'))
+ continue;
+ $ipport = get_frontend_ipport($frontend);
+ if (!isset($activefrontends[$ipport]))
+ $issues['S_'.$frontend['name']] = "Secondary frontend \"{$frontend['name']}\" without active primary frontend.";
+ }
+ foreach ($issues as $item)
+ $result .= ($result == false ? "" : "<br/>") . $item;
+ return $result;
+}
+
+function get_haproxy_frontends($excludeitem="") {
+ global $config;
+ $a_frontend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
+ $result = array();
+ foreach($a_frontend as &$frontend)
+ {
+ if ($frontend['secondary'])
+ continue;
+ if ($frontend['name'] == $excludeitem)
+ continue;
+
+ $serveradress = "{$frontend['extaddr']}:{$frontend['port']}";
+ $result[$frontend['name']]['name'] = "{$frontend['name']} - {$frontend['type']} ({$serveradress})";
+ $result[$frontend['name']]['ref'] = &$frontend;
+ }
+ asort($result, SORT_STRING);
+ return $result;
+}
+
+function phparray_to_javascriptarray_recursive($nestID, $path, $items, $nodeName, $includeitems) {
+ $offset = str_repeat(' ',$nestID);
+ $itemName = "item$nestID";
+ echo "{$offset}$nodeName = {};\n";
+ if (is_array($items))
+ foreach ($items as $key => $item)
+ {
+ if (in_array($path.'/'.$key, $includeitems))
+ $subpath = $path.'/'.$key;
+ else
+ $subpath = $path.'/*';
+ if (in_array($subpath, $includeitems) || in_array($path.'/*', $includeitems)) {
+ if (is_array($item)) {
+ $subNodeName = "item$nestID";
+ phparray_to_javascriptarray_recursive($nestID+1, $subpath, $items[$key], $subNodeName, $includeitems);
+ echo "{$offset}{$nodeName}['{$key}'] = $itemName;\n";
+ } else
+ echo "{$offset}{$nodeName}['$key'] = '$item';\n";
+ }
+ }
+}
+
+function phparray_to_javascriptarray($items, $javaMapName, $includeitems)
+{
+ phparray_to_javascriptarray_recursive(1,'',$items, $javaMapName, $includeitems);
+}
+
?>
diff --git a/config/haproxy-devel/haproxy_listeners.php b/config/haproxy-devel/haproxy_listeners.php
index 88cdb62f..7b4cf3da 100644
--- a/config/haproxy-devel/haproxy_listeners.php
+++ b/config/haproxy-devel/haproxy_listeners.php
@@ -34,6 +34,7 @@ require_once("guiconfig.inc");
$d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty";
require_once("haproxy.inc");
+require_once("certs.inc");
if (!is_array($config['installedpackages']['haproxy']['ha_backends']['item'])) {
$config['installedpackages']['haproxy']['ha_backends']['item'] = array();
@@ -57,12 +58,19 @@ if ($_POST) {
unlink_if_exists($d_haproxyconfdirty_path);
}
}
+} else {
+ $result = haproxy_check_config($retval);
+ if ($result)
+ $savemsg = gettext($result);
}
+$id = $_GET['id'];
+$id = get_frontend_id($id);
+
if ($_GET['act'] == "del") {
- if (isset($a_backend[$_GET['id']])) {
+ if (isset($a_backend[$id])) {
if (!$input_errors) {
- unset($a_backend[$_GET['id']]);
+ unset($a_backend[$id]);
write_config();
touch($d_haproxyconfdirty_path);
}
@@ -104,77 +112,101 @@ include("head.inc");
<tr>
<td>
<div id="mainarea">
- <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Name</td>
- <td width="30%" class="listhdrr">Description</td>
- <td width="20%" class="listhdrr">Address</td>
- <td width="10%" class="listhdrr">Type</td>
- <td width="10%" class="listhdrr">Server&nbsp;pool</td>
- <td width="5%" class="list"></td>
+ <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="5%" class="listhdrr">Primary</td>
+ <td width="20%" class="listhdrr">Advanced</td>
+ <td width="20%" class="listhdrr">Name</td>
+ <td width="30%" class="listhdrr">Description</td>
+ <td width="20%" class="listhdrr">Address</td>
+ <td width="5%" class="listhdrr">Type</td>
+ <td width="10%" class="listhdrr">Server&nbsp;pool</td>
+ <td width="20%" class="listhdrr">Parent</td>
+ <td width="5%" class="list"></td>
</tr>
<?php
- $i = 0;
- foreach ($a_backend as $backend):
- $textss = $textse = "";
- if ($backend['status'] != 'active') {
- $textss = "<span class=\"gray\">";
- $textse = "</span>";
+
+ function sort_backends(&$a, &$b) {
+ if ($a['ipport'] != $b['ipport'])
+ return $a['ipport'] > $b['ipport'] ? 1 : -1;
+ if ($a['secondary'] != $b['secondary'])
+ return $a['secondary'] > $b['secondary'] ? 1 : -1;
+ if ($a['name'] != $b['name'])
+ return $a['name'] > $b['name'] ? 1 : -1;
+ return 0;
}
-?>
- <tr>
- <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$i;?>';">
- <?=$textss . $backend['name'] . $textse;?>
- </td>
- <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$i;?>';">
- <?=$textss . $backend['desc'] . $textse;?>
- </td>
- <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$i;?>';">
-<?php
- echo $textss;
- if($backend['extaddr'] == "any")
- echo "0.0.0.0";
- elseif($backend['extaddr'])
- echo $backend['extaddr'];
- else
- echo get_current_wan_address('wan');
- echo ":" . $backend['port'];
- echo $textse;
-?>
- </td>
- <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$i;?>';">
- <?=$textss . $backend['type'] . $textse;?>
- </td>
- <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$i;?>';">
- <?=$textss . $backend['backend_serverpool'] . $textse;?>
- </td>
- <td class="list" nowrap>
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="haproxy_listeners_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td valign="middle"><a href="haproxy_listeners.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- <td valign="middle"><a href="haproxy_listeners_edit.php?dup=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php $i++; endforeach; ?>
- <tfoot>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="haproxy_listeners_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- </tfoot>
- </table>
+ foreach($a_backend as &$backend2) {
+ $backend2['ipport'] = get_frontend_ipport($backend2);
+ }
+ usort($a_backend,'sort_backends');
+
+ $certimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
+ unset($ipport_previous);
+ foreach ($a_backend as $backend):
+ $backendname = $backend['name'];
+ $textgray = $backend['status'] != 'active' ? " gray" : "";
+ if (isset($ipport_previous ) && $backend['ipport'] != $ipport_previous):
+ ?>
+ <tr class="<?=$textgray?>"><td collspan="7">&nbsp;</td></tr>
+ <?
+ endif;
+ $ipport_previous = $backend['ipport'];
+ ?>
+ <tr class="<?=$textgray?>">
+ <td class="listlr" style="<?=$backend['secondary']=='yes'?"visibility:hidden;":""?>" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['secondary']!='yes'?"yes":"no";?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <? if (strtolower($backend['type']) == "http" && $backend['ssloffload']):
+ $cert = lookup_cert($backend['ssloffloadcert']);?>
+ <img src="<?=$certimg;?>" alt="SSL offloading" title="SSL offloading cert: '<?=$cert['descr'];?>'" border="0" height="16" width="16" />
+ <? endif;?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['name'];?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['desc'];?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['ipport'];?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['type']?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['backend_serverpool']?>
+ </td>
+ <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$backendname;?>';">
+ <?=$backend['secondary'] == 'yes' ? $backend['primary_frontend'] : "";?>
+ </td>
+ <td class="list" nowrap>
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="haproxy_listeners_edit.php?id=<?=$backendname;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td valign="middle"><a href="haproxy_listeners.php?act=del&id=<?=$backendname;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
+ <td valign="middle"><a href="haproxy_listeners_edit.php?dup=<?=$backendname;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ <tfoot>
+ <tr>
+ <td class="list" colspan="8"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="haproxy_listeners_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
</div>
</table>
- </form>
+ </form>
<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/config/haproxy-devel/haproxy_listeners_edit.php b/config/haproxy-devel/haproxy_listeners_edit.php
index 3139250c..0826010c 100644
--- a/config/haproxy-devel/haproxy_listeners_edit.php
+++ b/config/haproxy-devel/haproxy_listeners_edit.php
@@ -101,18 +101,20 @@ function get_certificates_server($get_includeWebCert=false) {
if ($usagestr != "")
$usagestr = " (".trim($usagestr).")";
- $certificates[$cert['refid']] = $cert['descr'] . $caname . $inuse . $revoked . $usagestr;
+ $certificates[$cert['refid']]['name'] = $cert['descr'] . $caname . $inuse . $revoked . $usagestr;
}
return $certificates;
}
-function echo_html_select($name, $keyvaluelist, $selected, $listEmptyMessage="")
+function echo_html_select($name, $keyvaluelist, $selected, $listEmptyMessage="", $onchangeEvent="")
{
- if (count($keyvaluelist)>0){
- echo "<select name=\"$name\" class=\"formselect\">";
+ if (count($keyvaluelist)>0){
+ if ($onchangeEvent != "")
+ $onchangeEvent .= " onchange=$onchangeEvent";
+ echo "<select name=\"$name\" id=\"$name\" class=\"formselect\"$onchangeEvent>";
foreach($keyvaluelist as $key => $desc){
$selectedhtml = $key == $selected ? "selected" : "";
- echo "<option value=\"{$key}\" {$selectedhtml}>{$desc}</option>";
+ echo "<option value=\"{$key}\" {$selectedhtml}>{$desc['name']}</option>";
}
echo "</select>";
} else {
@@ -141,7 +143,7 @@ $a_backend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
$a_pools = &$config['installedpackages']['haproxy']['ha_pools']['item'];
global $simplefields;
-$simplefields = array('name','desc','status','secondary','type','forwardfor','httpclose','extaddr','backend_serverpool',
+$simplefields = array('name','desc','status','secondary','primary_frontend','type','forwardfor','httpclose','extaddr','backend_serverpool',
'max_connections','client_timeout','port','ssloffloadcert','dcertadv','ssloffload','ssloffloadacl');
if (isset($_POST['id']))
@@ -152,6 +154,8 @@ else
if (isset($_GET['dup']))
$id = $_GET['dup'];
+$id = get_frontend_id($id);
+
if (isset($id) && $a_backend[$id]) {
$pconfig['a_acl']=&$a_backend[$id]['ha_acls']['item'];
$pconfig['advanced'] = base64_decode($a_backend[$id]['advanced']);
@@ -193,7 +197,7 @@ if ($_POST) {
/* Ensure that our pool names are unique */
for ($i=0; isset($config['installedpackages']['haproxy']['ha_backends']['item'][$i]); $i++)
if (($_POST['name'] == $config['installedpackages']['haproxy']['ha_backends']['item'][$i]['name']) && ($i != $id))
- $input_errors[] = "This frontend name has already been used. Frontend names must be unique.";
+ $input_errors[] = "This frontend name has already been used. Frontend names must be unique. $i != $id";
$a_acl=array();
$acl_names=array();
@@ -273,7 +277,6 @@ if (!$id)
$pgtitle = "HAProxy: Frontend: Edit";
include("head.inc");
-
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
@@ -281,6 +284,7 @@ include("head.inc");
.haproxy_mode_http{display:none;}
.haproxy_ssloffloading_enabled{display:none;}
.haproxy_primary{}
+ .haproxy_secondary{display:none;}
</style>
<?php if($one_two): ?>
@@ -445,21 +449,32 @@ include("head.inc");
function updatevisibility()
{
+ d = document;
+ ssloffload = d.getElementById("ssloffload");
+ type = d.getElementById("type");
+ secondary = d.getElementById("secondary");
+ primary_frontend = d.getElementById("primary_frontend");
+
+ if (secondary.checked)
+ type = primaryfrontends[primary_frontend.value]['ref']['type'];
+ else
+ type = d.getElementById("type").value;
+
setCSSdisplay(".haproxy_ssloffloading_enabled", ssloffload.checked);
- setCSSdisplay(".haproxy_mode_http", type.value == "http");
+ setCSSdisplay(".haproxy_mode_http", type == "http");
setCSSdisplay(".haproxy_primary", !secondary.checked);
+ setCSSdisplay(".haproxy_secondary", secondary.checked);
+
+ type_change(type);
}
- function type_change() {
- var type, d, i, j, el, row;
+ function type_change(type) {
+ var d, i, j, el, row;
var count = <?=count($a_acltypes);?>;
var acl = [ <?php foreach ($a_acltypes as $expr) echo "'".$expr['name']."'," ?> ];
var mode = [ <?php foreach ($a_acltypes as $expr) echo "'".$expr['mode']."'," ?> ];
d = document;
- type = d.getElementById("type").value;
-
-
for (i = 0; i < 99; i++) {
el = d.getElementById("acl_expression" + i);
row = d.getElementById("aclrow" + i);
@@ -475,7 +490,6 @@ include("head.inc");
}
}
}
- updatevisibility();
}
</script>
<?php include("fbegin.inc"); ?>
@@ -502,24 +516,33 @@ include("head.inc");
</td>
</tr>
<tr align="left">
+ <td width="22%" valign="top" class="vncellreq">Status</td>
+ <td width="78%" class="vtable" colspan="2">
+ <select name="status" id="status">
+ <option value="active"<?php if($pconfig['status'] == "active") echo " SELECTED"; ?>>Active</option>
+ <option value="disabled"<?php if($pconfig['status'] == "disabled") echo " SELECTED"; ?>>Disabled</option>
+ </select>
+ </td>
+ </tr>
+ <tr align="left">
<td width="22%" valign="top" class="vncell">Shared Frontend</td>
<td width="78%" class="vtable" colspan="2">
- <input id="secondary" name="secondary" type="checkbox" value="yes" <?php if ($pconfig['secondary']=='yes') echo "checked"; ?> onclick="updatevisibility();">secondary backend</checkbox><br/>
+ <input id="secondary" name="secondary" type="checkbox" value="yes" <?php if ($pconfig['secondary']=='yes') echo "checked"; ?> onclick="updatevisibility();"/>
Use this setting to configure multiple backends/accesslists for a single frontend.<br/>
All settings of which only 1 can exist will be hidden.<br/>
The frontend settings will be merged into 1 set of frontend configuration.
</td>
</tr>
- <tr align="left">
- <td width="22%" valign="top" class="vncellreq">Status</td>
+ <tr class="haproxy_secondary" align="left">
+ <td width="22%" valign="top" class="vncellreq">Primary frontend</td>
<td width="78%" class="vtable" colspan="2">
- <select name="status" id="status">
- <option value="active"<?php if($pconfig['status'] == "active") echo " SELECTED"; ?>>Active</option>
- <option value="disabled"<?php if($pconfig['status'] == "disabled") echo " SELECTED"; ?>>Disabled</option>
- </select>
+ <?
+ $primaryfrontends = get_haproxy_frontends($pconfig['name']);
+ echo_html_select('primary_frontend',$primaryfrontends, $pconfig['primary_frontend'],"You must first create a 'primary' frontend.","updatevisibility();");
+ ?>
</td>
- </tr>
- <tr>
+ </tr>
+ <tr class="haproxy_primary">
<td width="22%" valign="top" class="vncellreq">External address</td>
<td width="78%" class="vtable">
<select name="extaddr" class="formfld">
@@ -546,7 +569,7 @@ include("head.inc");
</span>
</td>
</tr>
- <tr align="left">
+ <tr class="haproxy_primary" align="left">
<td width="22%" valign="top" class="vncellreq">External port</td>
<td width="78%" class="vtable" colspan="2">
<input name="port" type="text" <?if(isset($pconfig['port'])) echo "value=\"{$pconfig['port']}\"";?> size="30" maxlength="500">
@@ -576,10 +599,10 @@ include("head.inc");
}
?>
</select>
- <tr align="left">
+ <tr class="haproxy_primary" align="left">
<td width="22%" valign="top" class="vncellreq">Type</td>
<td width="78%" class="vtable" colspan="2">
- <select name="type" id="type" onchange="type_change();">
+ <select name="type" id="type" onchange="updatevisibility();">
<option value="http"<?php if($pconfig['type'] == "http") echo " SELECTED"; ?>>HTTP</option>
<option value="https"<?php if($pconfig['type'] == "https") echo " SELECTED"; ?>>HTTPS</option>
<option value="tcp"<?php if($pconfig['type'] == "tcp") echo " SELECTED"; ?>>TCP</option>
@@ -663,7 +686,11 @@ include("head.inc");
<br/>
The 'forwardfor' option creates an HTTP 'X-Forwarded-For' header which
contains the client's IP address. This is useful to let the final web server
- know what the client address was (eg for statistics on domains)
+ know what the client address was. (eg for statistics on domains)<br/>
+ <br/>
+ It is important to note that as long as HAProxy does not support keep-alive connections,
+ only the first request of a connection will receive the header. For this reason,
+ it is important to ensure that option httpclose is set when using this option.
</td>
</tr>
<tr align="left">
@@ -744,7 +771,7 @@ include("head.inc");
<input name="Submit" type="submit" class="formbtn" value="Save">
<input type="button" class="formbtn" value="Cancel" onclick="history.back()">
<?php if (isset($id) && $a_backend[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
+ <input name="id" type="hidden" value="<?=$a_backend[$id]['name'];?>">
<?php endif; ?>
</td>
</tr>
@@ -758,6 +785,12 @@ include("head.inc");
</form>
<br>
<script type="text/javascript">
+<?
+ phparray_to_javascriptarray($primaryfrontends,"primaryfrontends",Array('/*','/*/name','/*/ref','/*/ref/type','/*/ref/ssloffload'));
+?>
+
+</script>
+<script type="text/javascript">
field_counter_js = 3;
rows = 1;
totalrows = <?php echo $counter; ?>;
diff --git a/config/haproxy-devel/haproxy_pool_edit.php b/config/haproxy-devel/haproxy_pool_edit.php
index f244d3df..2ee880a2 100644
--- a/config/haproxy-devel/haproxy_pool_edit.php
+++ b/config/haproxy-devel/haproxy_pool_edit.php
@@ -450,7 +450,7 @@ row_helper();
<td width="22%" valign="top" class="vncell">Check freq</td>
<td width="78%" class="vtable" colspan="2">
<input name="checkinter" type="text" <?if(isset($pconfig['checkinter'])) echo "value=\"{$pconfig['checkinter']}\"";?>size="20"> milliseconds
- <br/>Defaults to 1000 if left blank.
+ <br/>For HTTP/HTTPS defaults to 1000 if left blank. For TCP no check will be performed if left empty.
</td>
</tr>
<tr align="left">