diff --git a/core/trunk/core/class/Url.php b/core/trunk/core/class/Url.php
index 596bb8065241ff03c2d210e7d4cd520e561c9876..515b866f364ebc034f7fbea74ae10612c1d2e854 100644
--- a/core/trunk/core/class/Url.php
+++ b/core/trunk/core/class/Url.php
@@ -195,10 +195,15 @@ class Url
 
     private static function _buildPort()
     {
-        return array_key_exists('HTTP_X_FORWARDED_PORT', $_SERVER)
-                ? $_SERVER['HTTP_X_FORWARDED_PORT'] : $_SERVER['SERVER_PORT'];
+        if(array_key_exists('HTTP_X_FORWARDED_PORT', $_SERVER)) {
+            return $_SERVER['HTTP_X_FORWARDED_PORT'];
+        } else if (array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER)) {
+            return '80';
+        } else {
+            return $_SERVER['SERVER_PORT'];
+        }
     }
-
+    
     private static function _buildProto()
     {
         if (array_key_exists('HTTP_X_FORWARDED_PROTO', $_SERVER)) {