}
$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']));
+
+ if (strpos($host, ':') !== false) {
+ $serverport = '';
+ }
return 'http' . ($https ? 's' : '') . '://'
. $host . $serverport . $scriptname;