From: Bryan Davis Date: Tue, 26 Aug 2014 03:44:22 +0000 (-0600) Subject: Use protocol default port with HTTP_X_FORWARDED_PROTO X-Git-Tag: 1.31.0-rc.0~14187^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=e2fb163be2cc558a6100a3e1af7ec0dbce2d4927;p=lhc%2Fweb%2Fwiklou.git Use protocol default port with HTTP_X_FORWARDED_PROTO When $_SERVER['HTTP_X_FORWARDED_PROTO'] is set, keep the detected protocol default port rather than using the local server port when creating a canonical URL. Bug: 70021 Change-Id: I2b37da5872929e1c461ff20cccf3dfe11f182a2f --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index a1fa0eb775..b187c4acef 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -181,7 +181,12 @@ class WebRequest { continue; } $host = $parts[0]; - if ( $parts[1] === false ) { + if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { + // Bug 70021: Assume that upstream proxy is running on the default + // port based on the protocol. We have no reliable way to determine + // the actual port in use upstream. + $port = $stdPort; + } elseif ( $parts[1] === false ) { if ( isset( $_SERVER['SERVER_PORT'] ) ) { $port = $_SERVER['SERVER_PORT']; } // else leave it as $stdPort