diff --git a/lib/private/api.php b/lib/private/api.php
index 0576f3e3f9356b9069f63b9491579912bd9d53ce..7e69a6a77d20490bc286e2716117c5da01a49ace 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -250,7 +250,7 @@ class OC_API {
 
 		// reuse existing login
 		$loggedIn = OC_User::isLoggedIn();
-		$ocsApiRequest = isset($_SERVER['OCS_APIREQUEST']) ? $_SERVER['OCS_APIREQUEST'] === 'true' : false;
+		$ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
 		if ($loggedIn === true && $ocsApiRequest) {
 			return OC_User::getUser();
 		}