Personal tools
Views

FAQ/Nonstandard ports

From CMSMS

This page in: English - Deutsch - Français - Svenska - Русский - Norsk - Polski - Nederlands - Español - Lietuvių

Support for non-standard ports

There are some reasons to run a site on a non-standard port, ie. other than 80 (HTTP) or 443 (HTTPS). The default generated config.php does not take into account the port from the HTTP request when generating the root_url to be used throughout the system.

Open your config.php in your favourite editor and add this

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
{
$config['root_url'] = str_replace('http','https',$config['root_url']);
}

/******************************************************************
Start support for non-standard ports
*******************************************************************/
if (isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT']!='80' && $_SERVER
['SERVER_PORT']!='443'))
{
$config['root_url'] = $config['root_url'] . ":" . $_SERVER['SERVER_PORT'];
}

AFTER line

$config['root_url'] = 'http://www.yourdomain.com';

Now it will work for non-standard ports. This also handles cases where apache listens on port 80, but a firewall is allowing NAT access on a different port and translating it to 80.

Thanks goes to user akpraha.


This page in: English - Deutsch - Français - Svenska - Русский - Norsk - Polski - Nederlands - Español - Lietuvių