diff --git a/lib/base.php b/lib/base.php
index 5905aa0406f570998f354d1f1ed619c70e9575a2..cdc662c28d968f1b70cb7549265f30fbc9634af7 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -626,7 +626,6 @@ class OC {
 			return;
 		}
 
-		$trustedDomainHelper = new \OC\Security\TrustedDomainHelper(\OC::$server->getConfig());
 		$request = \OC::$server->getRequest();
 		$host = $request->getInsecureServerHost();
 		/**
@@ -637,7 +636,7 @@ class OC {
 			// overwritehost is always trusted, workaround to not have to make
 			// \OC\AppFramework\Http\Request::getOverwriteHost public
 			&& self::$server->getConfig()->getSystemValue('overwritehost') === ''
-			&& !$trustedDomainHelper->isTrustedDomain($host)
+			&& !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host)
 		) {
 			header('HTTP/1.1 400 Bad Request');
 			header('Status: 400 Bad Request');
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 5cffbccb62394b3277934e9ef6c0e411fe8cb6c1..d85bfd4f30adfa93adef94daee7ea023909eba6c 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -128,9 +128,9 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 
 	}
 	/**
-	 * @param $parameters
+	 * @param array $parameters
 	 */
-	public function setUrlParameters($parameters) {
+	public function setUrlParameters(array $parameters) {
 		$this->items['urlParams'] = $parameters;
 		$this->items['parameters'] = array_merge(
 			$this->items['parameters'],
@@ -195,8 +195,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 
 	/**
 	 * Magic property accessors
-	 * @param $name
-	 * @param $value
+	 * @param string $name
+	 * @param mixed $value
 	 */
 	public function __set($name, $value) {
 		throw new \RuntimeException('You cannot change the contents of the request object');
@@ -253,7 +253,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	}
 
 	/**
-	 * @param $name
+	 * @param string $name
 	 * @return bool
 	 */
 	public function __isset($name) {
@@ -261,7 +261,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
 	}
 
 	/**
-	 * @param $id
+	 * @param string $id
 	 */
 	public function __unset($id) {
 		throw new \RunTimeException('You cannot change the contents of the request object');
diff --git a/lib/private/server.php b/lib/private/server.php
index 9422f332eb1a364e2dd72cda1b0b233a59687e39..7c7f3c25cc862b7d67f6265677406628fa03dbe2 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -17,6 +17,7 @@ use OC\Security\Crypto;
 use OC\Security\Hasher;
 use OC\Security\SecureRandom;
 use OC\Diagnostics\NullEventLogger;
+use OC\Security\TrustedDomainHelper;
 use OCP\IServerContainer;
 use OCP\ISession;
 use OC\Tagging\TagMapper;
@@ -260,6 +261,9 @@ class Server extends SimpleContainer implements IServerContainer {
 		$this->registerService('IniWrapper', function ($c) {
 			return new IniGetWrapper();
 		});
+		$this->registerService('TrustedDomainHelper', function ($c) {
+			return new TrustedDomainHelper($this->getConfig());
+		});
 	}
 
 	/**
@@ -324,7 +328,6 @@ class Server extends SimpleContainer implements IServerContainer {
 		);
 	}
 
-
 	/**
 	 * Returns the preview manager which can create preview images for a given file
 	 *
@@ -743,4 +746,13 @@ class Server extends SimpleContainer implements IServerContainer {
 	public function getIniWrapper() {
 		return $this->query('IniWrapper');
 	}
+
+	/**
+	 * Get the trusted domain helper
+	 *
+	 * @return TrustedDomainHelper
+	 */
+	public function getTrustedDomainHelper() {
+		return $this->query('TrustedDomainHelper');
+	}
 }