diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f65584..607dc2c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Under delevopment: [FlatPress 1.3.1](https://github.com/flatpressblog/flatpress/releases/tag/1.3.1) +# Under development: [FlatPress 1.3.1](https://github.com/flatpressblog/flatpress/releases/tag/1.3.1) ## Bugfixes - HTTP-only Login wasn't possible under some circumstances ([#371](https://github.com/flatpressblog/flatpress/issues/371), [#378](https://github.com/flatpressblog/flatpress/issues/378)) diff --git a/defaults.php b/defaults.php index 9bbf41d6..7c7c8808 100755 --- a/defaults.php +++ b/defaults.php @@ -130,6 +130,7 @@ // supports Apache and IIS $serverport = ''; +var_dump(is_https()); if (is_https()) { // HTTPS enabled $serverport = "https://"; @@ -171,15 +172,10 @@ header('X-Frame-Options: SAMEORIGIN'); header('X-XSS-Protection: 1; mode=block'); header('X-Content-Type-Options: nosniff'); - // - // End of send header - // - -#function _dummy() {} -#set_error_handler('_dummy'); - - +// +// End of send header +// /** * Checks if FlatPress is called via HTTPS. @@ -187,5 +183,14 @@ * @return boolean true when FlatPress is called via HTTPS; false otherwise. */ function is_https() { - return (isset($_SERVER ['HTTPS']) && ($_SERVER ['HTTPS'] == '1' || strtolower($_SERVER ['HTTPS']) == 'on')); + // HTTPS called web server + if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])) { + return true; + } + // HTTPS called reverse proxy / load balancer + if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { + $isSecure = true; + } + // none of the above: must be HTTP + return false; } \ No newline at end of file