*/
$wgSitename = 'MediaWiki';
+/**
+ * When the wiki is running behind a proxy and this is set to true, assumes that the proxy exposes
+ * the wiki on the standard ports (443 for https and 80 for http).
+ * @var bool
+ * @since 1.26
+ */
+$wgAssumeProxiesUseDefaultProtocolPorts = true;
+
/**
* URL of the server.
*
* @return string
*/
public static function detectServer() {
+ global $wgAssumeProxiesUseDefaultProtocolPorts;
+
$proto = self::detectProtocol();
$stdPort = $proto === 'https' ? 443 : 80;
if ( !isset( $_SERVER[$varName] ) ) {
continue;
}
+
$parts = IP::splitHostAndPort( $_SERVER[$varName] );
if ( !$parts ) {
// Invalid, do not use
continue;
}
+
$host = $parts[0];
- if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
+ if ( $wgAssumeProxiesUseDefaultProtocolPorts && 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.