Last modified: 2006-01-17 19:21:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T6539, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4539 - Having problems with Port Forwarding scenarios
Having problems with Port Forwarding scenarios
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
unspecified
Other Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-09 14:44 UTC by saveme
Modified: 2006-01-17 19:21 UTC (History)
0 users

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


Attachments

Description saveme 2006-01-09 14:44:50 UTC
I have an internal server where i host my wiki (mediawiki). We give people from 
outside our network, access this wiki (thru the internet). We had assigned a valid 
internet IP address and had done a portforwarding to the internal servers 80 port, at 
the gateway. This was not working, for users who tried to access the wiki outside our 
network, as once the connection gets port forwarded to the internal server....The 
$wgServer is set to the internal servers name, which is invisible from outside world. 
I dint find any doc which explains how to fix it. I tried a small patch, which works 
fine at least for me. Please let me know if there is any other fixes.

=== includes/DefaultSettings.php ===
/** This is the outside IP ( valid IP) */
/** comes handly when use the server as port forward for outside IPS */
$wgOutsideServer = '61.95.163.87';
/* give the inside accessing IP blocks */
$wgInsideIPblock = '192.168';
/*Hack end */

/** URL of the server. It will be automaticly build including https mode */
$wgServer = '';

if( isset( $_SERVER['SERVER_NAME'] ) ) {
    $wgServerName = $_SERVER['SERVER_NAME'];
} elseif( isset( $_SERVER['HOSTNAME'] ) ) {
    $wgServerName = $_SERVER['HOSTNAME'];
} elseif( isset( $_SERVER['HTTP_HOST'] ) ) {
    $wgServerName = $_SERVER['HTTP_HOST'];
} elseif( isset( $_SERVER['SERVER_ADDR'] ) ) {
    $wgServerName = $_SERVER['SERVER_ADDR'];
} else {
    $wgServerName = 'localhost';
}

/* Hack for IP redirect - Anil Menon */
/* if Im not comming from a internal IP, switch to my valid INTERNET IP */
$ip = (getenv(HTTP_X_FORWARDED_FOR)) ? getenv(HTTP_X_FORWARDED_FOR) : getenv
(REMOTE_ADDR);
if(! preg_match("/^$wgInsideIPblock/",$ip)) {
    $wgServerName = $wgOutsideServer;
}
Comment 1 Ævar Arnfjörð Bjarmason 2006-01-09 14:47:36 UTC
Try removing your hack and addin this to your apache configuration (I'm assuming
you use apache)

UseCanonicalName Off
Comment 2 Antoine "hashar" Musso (WMF) 2006-01-17 19:21:14 UTC
User fixed the issue (I can access its website from internet).

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


Navigation
Links