diff options
author | sullrich <sullrich@pfsense.org> | 2009-12-11 21:21:29 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-12-11 21:21:37 -0500 |
commit | b7f14b04290fa64b6fd26fe1c2bc4c213b4bbecf (patch) | |
tree | 924d3bd1cde956d2f6e66c272f65629a12c93145 /config/haproxy/haproxy.inc | |
parent | 9b9a08d5569e2d4924a37f02f56b7f7660a62855 (diff) | |
download | pfsense-packages-b7f14b04290fa64b6fd26fe1c2bc4c213b4bbecf.tar.gz pfsense-packages-b7f14b04290fa64b6fd26fe1c2bc4c213b4bbecf.tar.bz2 pfsense-packages-b7f14b04290fa64b6fd26fe1c2bc4c213b4bbecf.zip |
Overhaul haproxy package. Rename backends to frontends. Add rowhelper to the server edit screen for backend selection eliminating quite a number of needed configuration entries for common hosting items.
Diffstat (limited to 'config/haproxy/haproxy.inc')
-rw-r--r-- | config/haproxy/haproxy.inc | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index 11fd3782..0dcacab3 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -147,7 +147,14 @@ function haproxy_configure() { fwrite ($fd, "{$backendinfo}"); fwrite ($fd, "{$listenip}"); - fwrite ($fd, "\tmode\t\t\t".$backend['type'] . "\n"); + + // https is an alias for tcp for clarity purpouses + if($backend['type'] == "https") + $backend = "tcp"; + else + $backend = $backend['type']; + + fwrite ($fd, "\tmode\t\t\t" . $backend . "\n"); fwrite ($fd, "\tlog\t\t\tglobal\n"); fwrite ($fd, "\toption\t\t\tdontlognull\n"); fwrite ($fd, "\toption\t\t\thttpclose\n"); @@ -197,15 +204,21 @@ function haproxy_configure() { foreach ($a_acl as $acl) fwrite ($fd, "\tacl\t\t\t".$acl['name']."\t\t".$acl['expression']."\n"); + $server['backend'] .= " "; if(is_array($a_servers)) { foreach ($a_servers as $server) { - if($server['backend']==$backend['name']) { - if($server['status']=='active') { - if($server['cookie']) - $cookie = " cookie {$server['cookie']} "; - else - $cookie = ""; - fwrite ($fd, "\tserver\t\t\t".$server['name']." ".$server['address'].":".$server['port']." $cookie "." check inter 1000 weight ".$server['weight']."\n"); + $backends_to_process = split(" ", $server['backend']); + foreach($backends_to_process as $backend) { + if($backend == "") + continue; + if($backend ==$backend['name']) { + if($server['status']=='active') { + if($server['cookie']) + $cookie = " cookie {$server['cookie']} "; + else + $cookie = ""; + fwrite ($fd, "\tserver\t\t\t".$server['name']." ".$server['address'].":".$server['port']." $cookie "." check inter 1000 weight ".$server['weight']."\n"); + } } } } |