Qual: Don't attempt HTTPS redirect if already using HTTPS
This commit is contained in:
parent
53a9c93b90
commit
92c08c77fd
@ -225,7 +225,8 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
|
|||||||
|
|
||||||
|
|
||||||
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
|
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
|
||||||
if (! empty($conf->file->main_force_https))
|
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
|
||||||
|
if (! empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on'))
|
||||||
{
|
{
|
||||||
$newurl='';
|
$newurl='';
|
||||||
if (is_numeric($conf->file->main_force_https))
|
if (is_numeric($conf->file->main_force_https))
|
||||||
@ -239,21 +240,13 @@ if (! empty($conf->file->main_force_https))
|
|||||||
}
|
}
|
||||||
else // Check HTTPS environment variable (Apache/mod_ssl only)
|
else // Check HTTPS environment variable (Apache/mod_ssl only)
|
||||||
{
|
{
|
||||||
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
|
$newurl=preg_replace('/^http:/i','https:',DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
|
||||||
if (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') // If link is http
|
|
||||||
{
|
|
||||||
$newurl=preg_replace('/^http:/i','https:',DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check HTTPS environment variable (Apache/mod_ssl only)
|
// Check HTTPS environment variable (Apache/mod_ssl only)
|
||||||
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
|
$newurl=$conf->file->main_force_https.$_SERVER["REQUEST_URI"];
|
||||||
if (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') // If link is http
|
|
||||||
{
|
|
||||||
$newurl=$conf->file->main_force_https.$_SERVER["REQUEST_URI"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Start redirect
|
// Start redirect
|
||||||
if ($newurl)
|
if ($newurl)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user