----- Original Message -----
From: "Georg Schönberger"
<gschoenberger(a)thomas-krenn.com>
To: mediawiki-l(a)lists.wikimedia.org
Sent: Wednesday, 3 December, 2014 11:24:02 AM
Subject: [MediaWiki-l] Protocol relative image URLs with Pound and https
Hi Meadiawiki Team/Users,
I am currently preparing our Mediawiki to run with HTTPS behind Pound and
Varnish.
The setup went very well so far but now I have troubles with getting mixed
content on image urls.
As Mediawiki is using protocol relative URLs (for images too?) I thought I
don't have to setup
much, if the protocol is detected correctly. Pound adds the
'HTTP_X_FORWARDED_PROTO' Header, and
I've found the Mediawiki detection in includes/WebRequest.php:
if ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ==
'on' ) ||
( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) ) {
return 'https';
Therefore I assume that protocol detection works correctly. I have also
enabled $wgSecureLogin to see
if protocol detection works, and as far as I can see it does. I have also run
* echo $this->getRequest()->getProtocol();
on a Special Page, and this prints "https" even behind Pound. So Mediawiki
should detect the Pound Header.
But images are still used with <img alt="..." src="http://..">,
even if the
page is called with https://.
Are any further steps to get images work with https? (e.g. set $_SERVER
variables)
Are images using protocol relative paths per default?
I am using
* Mediawiki 1.23.7 (987edf2) 09:58, 28 November 2014
OK, I've got the error now - ensure to use protocol relative URLs with foreign file
repos:
$wgForeignFileRepos[] = array(
'class' => 'ForeignDBRepo',
'name' => 'otherwiki',
'url' => "//www.example.com/images",
[...]
Then Mediawiki is handling links/images correctly behind pound.
- Georg