Commit 66e69867 by Qiang Xue

Fixes issue #457: incorrect HTTPS detection.

parent f3cfc60d
...@@ -251,7 +251,7 @@ class Connection extends Component ...@@ -251,7 +251,7 @@ class Connection extends Component
*/ */
private $_schema; private $_schema;
/** /**
* Returns a value indicating whether the DB connection is established. * Returns a value indicating whether the DB connection is established.
* @return boolean whether the DB connection is established * @return boolean whether the DB connection is established
......
...@@ -533,8 +533,8 @@ class Request extends \yii\base\Request ...@@ -533,8 +533,8 @@ class Request extends \yii\base\Request
*/ */
public function getIsSecureConnection() public function getIsSecureConnection()
{ {
return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off') return isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)
|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']==='https'; || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https';
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment