]> git.wh0rd.org - tt-rss.git/commitdiff
sanity: check X-Forwarded-Proto for self_url
authorCédric Barboiron <ced@winkie.fr>
Mon, 10 Jul 2017 12:00:56 +0000 (14:00 +0200)
committerCédric Barboiron <ced@winkie.fr>
Mon, 10 Jul 2017 12:04:50 +0000 (14:04 +0200)
include/sanity_check.php

index 2f5315edf622a4a8fa4615c039eb9ccfe1d0f912..ea7b0da806e30da87793132368d54348116c16a8 100755 (executable)
@@ -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;
        }