keyfield = "name"; if ($_POST) { $pconfig = $_POST; if ($_POST['apply']) { $result = haproxy_check_and_run($savemsg, true); if ($result) unlink_if_exists($d_haproxyconfdirty_path); } else { $a_files = $fileslist->haproxy_htmllist_get_values($fields_files); $filedupcheck = array(); foreach($a_files as $key => $file) { $name = $file['name']; if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\.\-_]*$/", $file['name'])) $input_errors[] = "The field 'Name' (".htmlspecialchars($file['name']).") contains invalid characters. Use only: a-zA-Z0-9.-_ and start with a letter"; if (isset($filedupcheck[$name])) $input_errors[] = "Duplicate names are not allowed: " . htmlspecialchars($name); $filedupcheck[$name] = true; } // replace references in backends to renamed 'files' foreach($a_pools as &$backend) { if (is_arrayset($backend,'errorfiles','item')) foreach($backend['errorfiles']['item'] as &$errorfile) { $found = false; foreach($a_files as $key => $file) { if ($errorfile['errorfile'] == $key) { $errorfile['errorfile'] = $file['name']; $found = true; } } if (!$found) $input_errors[] = "Errorfile marked for deletion: " . $errorfile['errorfile'] . " which is used in backend " . $backend['name']; } } if (!$input_errors) { // save config when no errors found touch($d_haproxyconfdirty_path); write_config($changedesc); header("Location: haproxy_files.php"); exit; } } } $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); $pgtitle = "Services: HAProxy: Files"; include("head.inc"); ?>
You must apply the changes in order for them to take effect.");?>
Files can be used for errorfiles, that can return custom error pages in case haproxy reports a error (like no available backend). The content needs to be less than the buffer size which is typically 8kb. There are 2 possible variables to use inside the template: Put these variables in the content of the errorfile templates and they will be replaced by the actual errorcode / message. (include the curly braces around the text)
{errorcode} this represents the errorcode
{errormsg} this represents the human readable error
 
Draw($a_files); ?>