From 1980fb6674d51d73f5ed6aa6e48dc2133d373a36 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sat, 12 Dec 2015 21:42:34 +0100 Subject: haproxy-devel, small fixes --- config/haproxy-devel/pkg/haproxy.inc | 9 ++++++--- config/haproxy-devel/pkg/haproxy_socketinfo.inc | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'config/haproxy-devel/pkg') diff --git a/config/haproxy-devel/pkg/haproxy.inc b/config/haproxy-devel/pkg/haproxy.inc index 3d614fe0..8dce42ee 100644 --- a/config/haproxy-devel/pkg/haproxy.inc +++ b/config/haproxy-devel/pkg/haproxy.inc @@ -43,7 +43,10 @@ $a_frontendmode = array(); $a_frontendmode['http'] = array('name' => "http / https(offloading)", 'shortname' => "http/https"); $a_frontendmode['https'] = array('name' => "ssl / https(TCP mode)", 'shortname' => "ssl/https"); $a_frontendmode['tcp'] = array('name' => "tcp", 'shortname' => "tcp"); -$a_frontendmode['health'] = array('name' => "health", 'shortname' => "health"); +/* + if anyone actually used this what was it good for with recent package versions? +$a_frontendmode['health'] = array('name' => "health", 'shortname' => "health"); +*/ global $a_acltypes; $a_acltypes = array(); @@ -1738,8 +1741,8 @@ function haproxy_writeconf($configpath) { if ($bind['forwardfor']) { fwrite ($fd, "\toption\t\t\tforwardfor\n"); fwrite ($fd, "\tacl https ssl_fc\n"); - fwrite ($fd, "\treqadd X-Forwarded-Proto:\ http if !https\n"); - fwrite ($fd, "\treqadd X-Forwarded-Proto:\ https if https\n"); + fwrite ($fd, "\thttp-request set-header\t\tX-Forwarded-Proto http if !https\n"); + fwrite ($fd, "\thttp-request set-header\t\tX-Forwarded-Proto https if https\n"); } } diff --git a/config/haproxy-devel/pkg/haproxy_socketinfo.inc b/config/haproxy-devel/pkg/haproxy_socketinfo.inc index cbfb131b..7dbb6221 100644 --- a/config/haproxy-devel/pkg/haproxy_socketinfo.inc +++ b/config/haproxy-devel/pkg/haproxy_socketinfo.inc @@ -40,14 +40,18 @@ $show_clients_traffic = "YES"; function haproxy_socket_command($command){ $result = array(); if (file_exists("/tmp/haproxy.socket")) { - $socket = stream_socket_client('unix:///tmp/haproxy.socket', $errno, $errstr); + $socket = @stream_socket_client('unix:///tmp/haproxy.socket', $errno, $errstr); if ($socket) { fwrite($socket, "$command\n"); while (!feof($socket)) { $result[] = fgets($socket); } fclose($socket); + } else { + echo "cannot open command socket, haproxy not running? ({$errstr})"; } + } else { + echo "haproxy command socket does not exist, haproxy not running?"; } return $result; } -- cgit v1.2.3