Merge pull request #104 from sofwerx/https-proxy

Adding a check for HTTP_X_FORWARDED_PROTO in https_is_running()
This commit is contained in:
Ramón Novoa 2018-10-11 09:34:26 +02:00 committed by GitHub
commit 3e584747b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,10 @@ require_once('functions_io.php');
//}
function https_is_running() {
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
return true;
}
if (isset ($_SERVER['HTTPS'])
&& ($_SERVER['HTTPS'] === true
|| $_SERVER['HTTPS'] == 'on')) {

View File

@ -2378,6 +2378,10 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
$port = null; // null means 'use the starndard port'
$proxy = false; //By default Pandora FMS doesn't run across proxy.
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS'] = 'on';
}
if (isset ($_SERVER['HTTPS'])
&& ($_SERVER['HTTPS'] === true
|| $_SERVER['HTTPS'] == 'on')) {