private static function getServerHTTPS()
{
if (!array_key_exists('HTTPS', $_SERVER)) {
// not an https-request
return false;
}
if ($_SERVER['HTTPS'] === 'off') {
// IIS with HTTPS off
return false;
}
// otherwise, HTTPS will be a non-empty string
return $_SERVER['HTTPS'] !== '';
}