Index: lib/ezutils/classes/ezsys.php
===================================================================
--- lib/ezutils/classes/ezsys.php	(revision 23690)
+++ lib/ezutils/classes/ezsys.php	(working copy)
@@ -583,12 +583,19 @@
     */
     static function hostname()
     {
-        $retVal = eZSys::serverVariable( 'HTTP_X_FORWARDED_HOST', true );
-        if ( !$retVal )
+        $forwardedHostsString = eZSys::serverVariable( 'HTTP_X_FORWARDED_HOST', true );
+        if ( $forwardedHostsString )
         {
-            $retVal = eZSys::serverVariable( 'HTTP_HOST' );
+            $forwardedHosts = explode( ',', $forwardedHostsString );
+            if ( is_array( $forwardedHosts ) and count( $forwardedHosts ) > 0 )
+            {
+                $retVal = trim( $forwardedHosts[0] );
+                if ( $retVal != '' )
+                    return $retVal;
+            }
         }
-        return  $retVal;
+
+        return eZSys::serverVariable( 'HTTP_HOST' );
     }
 
     /*!
