From 551c1616f5f9beb91d38505551bf34609ba7fd97 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 4 Apr 2013 10:29:28 +0200 Subject: [PATCH] don't include specialsettings or default-vhost-content to ssl-redirects, fixes #1136 Signed-off-by: Michael Kaufmann (d00p) --- .../jobs/cron_tasks.inc.http.10.apache.php | 21 ++++++------ .../jobs/cron_tasks.inc.http.20.lighttpd.php | 32 +++++++++---------- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 15 +++++---- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 197382e3..eac0d981 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -812,21 +812,18 @@ class apache $vhost_content.= $this->getStats($domain); } $vhost_content.= $this->getLogfiles($domain); - } - if($domain['specialsettings'] != '') - { - $vhost_content.= $domain['specialsettings'] . "\n"; - } + if ($domain['specialsettings'] != '') { + $vhost_content.= $domain['specialsettings'] . "\n"; + } - if($ipandport['default_vhostconf_domain'] != '') - { - $vhost_content.= $ipandport['default_vhostconf_domain'] . "\n"; - } + if ($ipandport['default_vhostconf_domain'] != '') { + $vhost_content.= $ipandport['default_vhostconf_domain'] . "\n"; + } - if($this->settings['system']['default_vhostconf'] != '') - { - $vhost_content.= $this->settings['system']['default_vhostconf'] . "\n"; + if ($this->settings['system']['default_vhostconf'] != '') { + $vhost_content.= $this->settings['system']['default_vhostconf'] . "\n"; + } } $vhost_content.= '' . "\n"; diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index f8424e2e..91224190 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -467,36 +467,36 @@ class lighttpd mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true); $only_webroot = false; - if($ssl_vhost === false && $domain['ssl_redirect'] == '1') - { + if ($ssl_vhost === false + && $domain['ssl_redirect'] == '1' + ) { $only_webroot = true; } $vhost_content.= $this->getWebroot($domain, $ssl_vhost); - if(!$only_webroot) - { + if (!$only_webroot) { if ($this->_deactivated == false) { $vhost_content.= $this->create_htaccess($domain); $vhost_content.= $this->create_pathOptions($domain); $vhost_content.= $this->composePhpOptions($domain); $vhost_content.= $this->getStats($domain); $vhost_content.= $this->getSslSettings($domain, $ssl_vhost); + + if ($domain['specialsettings'] != "") { + $vhost_content.= $domain['specialsettings'] . "\n"; + } + + if ($ipandport['default_vhostconf_domain'] != '') { + $vhost_content.= $ipandport['default_vhostconf_domain'] . "\n"; + } + + if ($this->settings['system']['default_vhostconf'] != '') { + $vhost_content.= $this->settings['system']['default_vhostconf'] . "\n"; + } } $vhost_content.= $this->getLogFiles($domain); } } - if ($domain['specialsettings'] != "") { - $vhost_content.= $domain['specialsettings'] . "\n"; - } - - if ($ipandport['default_vhostconf_domain'] != '') { - $vhost_content.= $ipandport['default_vhostconf_domain'] . "\n"; - } - - if ($this->settings['system']['default_vhostconf'] != '') { - $vhost_content.= $this->settings['system']['default_vhostconf'] . "\n"; - } - $vhost_content.= '}' . "\n"; return $vhost_content; diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 3aa2165f..8ed0c217 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -411,9 +411,12 @@ class nginx } $vhost_content = ''; - $vhost_content.= 'server { ' . "\n"; - $vhost_content.= "\t" . 'listen ' . $ipport . ';' . "\n"; + // open vhost-container + $vhost_content.= 'server { ' . "\n"; + // listening statement (required) + $vhost_content.= "\t" . 'listen ' . $ipport . ';' . "\n"; + // get all server-names $vhost_content.= $this->getServerNames($domain); // respect ssl_redirect settings, #542 @@ -424,12 +427,10 @@ class nginx $domain['documentroot'] = 'https://' . $domain['domain'] . '/'; } - if(preg_match('/^https?\:\/\//', $domain['documentroot'])) - { + // if the documentroot is an URL we just redirect + if (preg_match('/^https?\:\/\//', $domain['documentroot'])) { $vhost_content.= "\t".'rewrite ^(.*) '.$this->idnaConvert->encode($domain['documentroot']).'$1 permanent;'."\n"; - } - else - { + } else { mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true); $vhost_content.= $this->getLogFiles($domain);