Skip to content

Commit

Permalink
do not use HTTP_HOST variable if mod_rewrite is not used
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kaufmann (d00p) <[email protected]>
  • Loading branch information
d00p committed Jan 24, 2017
1 parent 8030aae commit 95a18be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/jobs/cron_tasks.inc.http.10.apache.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ protected function getVhostContent($domain, $ssl_vhost = false)
$vhost_content .= '<VirtualHost ' . trim($ipportlist) . '>' . "\n";
$vhost_content .= $this->getServerNames($domain);

$domain['documentroot_norewrite'] = $domain['documentroot'];
if (($ssl_vhost == false && $domain['ssl'] == '1' && $domain['ssl_redirect'] == '1')) {
// We must not check if our port differs from port 443,
// but if there is a destination-port != 443
Expand All @@ -833,6 +834,7 @@ protected function getVhostContent($domain, $ssl_vhost = false)
}

$domain['documentroot'] = 'https://%{HTTP_HOST}' . $_sslport . '/';
$domain['documentroot_norewrite'] = 'https://' . $domain['domain'] . $_sslport . '/';
}

if ($ssl_vhost === true && $domain['ssl'] == '1' && Settings::Get('system.use_ssl') == '1') {
Expand Down Expand Up @@ -921,7 +923,7 @@ protected function getVhostContent($domain, $ssl_vhost = false)
$vhost_content .= ' RewriteRule ^/(.*) ' . $corrected_docroot . '$1' . $modrew_red . "\n";
$vhost_content .= ' </IfModule>' . "\n";
$vhost_content .= ' <IfModule !mod_rewrite.c>' . "\n";
$vhost_content .= ' Redirect ' . $code . ' / ' . $corrected_docroot . "\n";
$vhost_content .= ' Redirect ' . $code . ' / ' . $domain['documentroot_norewrite'] . "\n";
$vhost_content .= ' </IfModule>' . "\n";
} else {

Expand Down

0 comments on commit 95a18be

Please sign in to comment.