Last modified: 2006-01-17 19:21:14 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; }
Try removing your hack and addin this to your apache configuration (I'm assuming you use apache) UseCanonicalName Off
User fixed the issue (I can access its website from internet).