diff --git a/lib/request.php b/lib/request.php
index aa5f53c08eb62bb380760e1e465a06789ed54a8e..df33217f95d65bde3bcddc1af2e0e37ea5e78816 100755
--- a/lib/request.php
+++ b/lib/request.php
@@ -9,7 +9,7 @@
 class OC_Request {
 	/**
 	 * @brief Check overwrite condition
-	 * @returns true/false
+	 * @returns bool
 	 */
 	private static function isOverwriteCondition($type = '') {
 		$regex = '/' . OC_Config::getValue('overwritecondaddr', '')  . '/';
@@ -40,7 +40,13 @@ class OC_Request {
 			}
 		}
 		else{
-			$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
+			if (isset($_SERVER['HTTP_HOST'])) {
+				return $_SERVER['HTTP_HOST'];
+			}
+			if (isset($_SERVER['SERVER_NAME'])) {
+				return $_SERVER['SERVER_NAME'];
+			}
+			return 'localhost';
 		}
 		return $host;
 	}