diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 444d541cd98..8d3812d5553 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -257,7 +257,7 @@ 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') // $_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')) { @@ -284,6 +284,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV // Start redirect if ($newurl) { + header_remove(); // Clean header already set to be sure to remove any header like "Set-Cookie: DOLSESSID_..." from non HTTPS answers dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); header("Location: ".$newurl); exit;