From b78634799678194727b679ff727d97dbdfbaad6f Mon Sep 17 00:00:00 2001 From: awjrichards Date: Thu, 3 Jan 2013 15:45:44 -0800 Subject: [PATCH] Makes WebRequest::detectProtocolAndStdPort() take HTTP_X_FORWARDED_PROTO headers into account Change-Id: I4debf1460b6357962fc634f781416929bcca2d76 --- includes/WebRequest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; } /** -- 2.20.1