From 55efecb4ab181dea5b8b2db50434ae55dc3a6955 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 11 May 2017 23:16:13 +0200 Subject: [PATCH] webgui: restructure previous for clarity --- src/etc/inc/plugins.inc.d/webgui.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/webgui.inc b/src/etc/inc/plugins.inc.d/webgui.inc index 95803315d..fba811c23 100644 --- a/src/etc/inc/plugins.inc.d/webgui.inc +++ b/src/etc/inc/plugins.inc.d/webgui.inc @@ -289,10 +289,8 @@ EOD; $lighty_config .= "server.bind = \"0.0.0.0\"\n"; $lighty_config .= "server.port = {$lighty_port}\n"; - $lighty_config .= "\$SERVER[\"socket\"] == \"0.0.0.0:{$lighty_port}\" { }\n"; - $lighty_config .= "\$SERVER[\"socket\"] == \"[::]:{$lighty_port}\" { \n"; - $ssl_config = " "; + $ssl_config = ''; $cert = str_replace("\r", "", $cert); $key = str_replace("\r", "", $key); @@ -341,13 +339,20 @@ EOD; } } - $lighty_config .= $ssl_config; - $lighty_config .= " }\n"; + $lighty_config .= "\$SERVER[\"socket\"] == \"[::]:{$lighty_port}\" {\n"; + /* address a bug in IPv6 handling */ if ($config['system']['webgui']['protocol'] == "https") { $lighty_config .= $ssl_config; } + $lighty_config .= "}\n\n"; + + $lighty_config .= "\$SERVER[\"socket\"] == \"0.0.0.0:{$lighty_port}\" { }\n"; + + if ($config['system']['webgui']['protocol'] == "https") { + $lighty_config .= $ssl_config; + } $lighty_config .= <<