Skip to content

Commit

Permalink
Make isHttps independent of PmaAbsoluteUri
Browse files Browse the repository at this point in the history
Issue #11412

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Feb 3, 2016
1 parent 8f17813 commit 218ece6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions libraries/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1540,12 +1540,21 @@ public function isHttps()
return $this->get('is_https');
}

$url = parse_url($this->get('PmaAbsoluteUri'));

// CloudFlare Flexible SSL compatibility
$this->set('force_protocol', in_array(PMA_getenv('HTTP_X_FORWARDED_PROTO'), array('http', 'https'), true));

$is_https = $this->get('force_protocol') ? PMA_getenv('HTTP_X_FORWARDED_PROTO') : isset($url['scheme']) && $url['scheme'] == 'https';
$is_https = false;
if (strtolower(PMA_getenv('HTTP_SCHEME')) == 'https') {
$is_https = true;
} elseif (strtolower(PMA_getenv('HTTPS')) == 'on') {
$is_https = true;
} elseif (strtolower(PMA_getenv('HTTP_HTTPS_FROM_LB')) == 'on') {
// A10 Networks load balancer
$is_https = true;
} elseif (strtolower(PMA_getenv('HTTP_FRONT_END_HTTPS')) == 'on') {
$is_https = true;
} elseif (strtolower(PMA_getenv('HTTP_X_FORWARDED_PROTO')) == 'https') {
$is_https = true;
} elseif (PMA_getenv('SERVER_PORT') === '443') {
$is_https = true;
}

$this->set('is_https', $is_https);

Expand Down

0 comments on commit 218ece6

Please sign in to comment.