aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/pkg/haproxy.inc
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2015-10-24 20:45:43 +0200
committerPiBa-NL <pba_2k3@yahoo.com>2015-10-24 20:45:43 +0200
commite3d4b3b7f7ae0eeb936f734f696d3f5bbfe2c762 (patch)
treedf55e7629d63f7bd60594d72a8af44d59f8a3017 /config/haproxy-devel/pkg/haproxy.inc
parent0382b3aba6bef1d6f0c92109ca39a01dc2ca46a0 (diff)
downloadpfsense-packages-e3d4b3b7f7ae0eeb936f734f696d3f5bbfe2c762.tar.gz
pfsense-packages-e3d4b3b7f7ae0eeb936f734f696d3f5bbfe2c762.tar.bz2
pfsense-packages-e3d4b3b7f7ae0eeb936f734f696d3f5bbfe2c762.zip
haproxy-devel, avoid possible config upgrade error messages, add actually writhing the configured frontend errorfiles to the config
Diffstat (limited to 'config/haproxy-devel/pkg/haproxy.inc')
-rw-r--r--config/haproxy-devel/pkg/haproxy.inc24
1 files changed, 19 insertions, 5 deletions
diff --git a/config/haproxy-devel/pkg/haproxy.inc b/config/haproxy-devel/pkg/haproxy.inc
index 7a07e9a7..afa10fb7 100644
--- a/config/haproxy-devel/pkg/haproxy.inc
+++ b/config/haproxy-devel/pkg/haproxy.inc
@@ -1295,7 +1295,7 @@ function haproxy_updateocsp($socketupdate = true) {
}
function haproxy_writeconf($configpath) {
- global $config;
+ global $config, $a_files_cache;
global $aliastable;
global $a_action;
if (!isset($aliastable)) {
@@ -1595,6 +1595,24 @@ function haproxy_writeconf($configpath) {
fwrite ($fd, "\ttimeout client\t\t{$bind['client_timeout']}\n");
+ if (is_arrayset($bind,'a_errorfiles','item')) {
+ foreach($bind['a_errorfiles']['item'] as $errorfile) {
+ if (!is_array($a_files_cache)) {// load only once
+ $a_files_cache = haproxy_get_fileslist();
+ }
+ $file = $errorfile['errorfile'];
+ $errorcodes = explode(",",$errorfile['errorcode']);
+ foreach($errorcodes as $errorcode) {
+ $filename = "$configpath/errorfile_{$name}_{$errorcode}_{$file}";
+ $content = base64_decode($a_files_cache[$file]['content']);
+ $content = str_replace('{errormsg}', $a_error[$errorcode]['descr'], $content);
+ $content = str_replace('{errorcode}', $errorcode, $content);
+ file_put_contents($filename, $content);
+ fwrite ($fd, "\terrorfile\t\t\t" . $errorcode ." " . $filename . "\n");
+ }
+ }
+ }
+
// Advanced pass thru
if ($bind['advanced']) {
$advanced = explode("\n", base64_decode($bind['advanced']));
@@ -1647,12 +1665,8 @@ function haproxy_writeconf($configpath) {
$item['use_backendbackend'] = $frontend['backend_serverpool'];
$a_actionitems[] = $item;
}
-
- //$backend = haproxy_find_backend($frontend['backend_serverpool']);
- //$transparent_clientip = $backend["transparent_clientip"] == 'yes';
$transparent_clientip = frontend_usetransparentbackend($frontend);
-
$allowfordefaultbackend = true;
$ipv = array();
if ($transparent_clientip) {