Improve HTTPS detection with proxies
Fixes #344. Thanks @Robby- Implementation details taken from Symfony 3.0.4, method \Symfony\Component\HttpFoundation\Request::isSecure(), see https://github.com/symfony/symfony/blob/v3.0.4/src/Symfony/Component/HttpFoundation/Request.php#L1169-L1192
This commit is contained in:
parent
27d32430ee
commit
8dfb1b14c7
@ -8,6 +8,7 @@ Released: -
|
|||||||
* [Changed] Improve documentation
|
* [Changed] Improve documentation
|
||||||
* [Changed] Add CSS rules for definition lists to default theme
|
* [Changed] Add CSS rules for definition lists to default theme
|
||||||
* [Fixed] #342: Fix responsiveness in default theme
|
* [Fixed] #342: Fix responsiveness in default theme
|
||||||
|
* [Fixed] #344: Improve HTTPS detection with proxies
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version 1.0.2
|
### Version 1.0.2
|
||||||
|
@ -1237,12 +1237,13 @@ class Pico
|
|||||||
}
|
}
|
||||||
|
|
||||||
$protocol = 'http';
|
$protocol = 'http';
|
||||||
if (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off')) {
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
|
||||||
|
$secureProxyHeader = strtolower(current(explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])));
|
||||||
|
$protocol = in_array($secureProxyHeader, array('https', 'on', 'ssl', '1')) ? 'https' : 'http';
|
||||||
|
} elseif (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off')) {
|
||||||
$protocol = 'https';
|
$protocol = 'https';
|
||||||
} elseif ($_SERVER['SERVER_PORT'] == 443) {
|
} elseif ($_SERVER['SERVER_PORT'] == 443) {
|
||||||
$protocol = 'https';
|
$protocol = 'https';
|
||||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) {
|
|
||||||
$protocol = 'https';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config['base_url'] =
|
$this->config['base_url'] =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user