Manual:$wgAssumeProxiesUseDefaultProtocolPorts

Details
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).