Last modified: 2010-05-15 15:59:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 13898 - ImagePage refers to local server for Upload new version
ImagePage refers to local server for Upload new version
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
  Show dependency treegraph
Reported: 2008-04-30 13:59 UTC by Sandro Tosi
Modified: 2010-05-15 15:59 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Sandro Tosi 2008-04-30 13:59:30 UTC
The page include/ImagePage.php generates the link for "Upload a new version of this file" referring to the local server where the wiki is installed, using the function "getUploadUrl()".

This cause problems when you use a reverse proxy in from of the wiki, and the RP is on another server: the  link generated for "Upload a new version of this file" is for the local server and not the url masked by the RP.

To fix the situation, and use a realtive url, I've applied the following patch:

$ diff -urNad includes/ImagePage.php.orig includes/ImagePage.php
--- includes/ImagePage.php.orig 2008-04-30 15:54:31.000000000 +0200
+++ includes/ImagePage.php      2008-04-30 15:56:10.000000000 +0200
@@ -366,7 +366,7 @@
        function getUploadUrl() {
                global $wgServer;
                $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
-               return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
+               return /*$wgServer .*/ $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );

Comment 1 Brion Vibber 2008-04-30 18:56:44 UTC
In this case, *all* your other generated full URLs would also be incorrect -- redirects, RSS feeds, action=render full URL expansion, print mode footer, etc.

In situations where your web server reports the wrong hostname, protocol, or port to the PHP environment, you should ensure that $wgServer is overridden to the correct URL prefix in your LocalSettings.php.

Note You need to log in before you can comment on or make changes to this bug.