From: awjrichards Date: Thu, 3 Jan 2013 23:45:44 +0000 (-0800) Subject: Makes WebRequest::detectProtocolAndStdPort() take HTTP_X_FORWARDED_PROTO headers... X-Git-Tag: 1.31.0-rc.0~21114^2 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=b78634799678194727b679ff727d97dbdfbaad6f;p=lhc%2Fweb%2Fwiklou.git Makes WebRequest::detectProtocolAndStdPort() take HTTP_X_FORWARDED_PROTO headers into account Change-Id: I4debf1460b6357962fc634f781416929bcca2d76 --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 8cf25bbd03..fc1cdb59aa 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -192,7 +192,14 @@ class WebRequest { * @return array */ public static function detectProtocolAndStdPort() { - return ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? array( 'https', 443 ) : array( 'http', 80 ); + if ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) || + ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) ) { + $arr = array( 'https', 443 ); + } else { + $arr = array( 'http', 80 ); + } + return $arr; } /**