sanity: check X-Forwarded-Proto for self_url

This commit is contained in:
Cédric Barboiron 2017-07-10 14:00:56 +02:00
parent be61f1c45c
commit 643ebe4229
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,8 @@
* to get out. */
function make_self_url_path() {
$url_path = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$proto = ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https' : 'http';
$url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
return $url_path;
}