diff --git a/ocs/v1.php b/ocs/v1.php
index 4580221e600d3ed5a7b1746a77a4b57bf0c7e4a2..7cd61035e7c94919176e9f0100dbb57ef024121f 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -23,6 +23,7 @@
 
 require_once('../lib/base.php');
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
+use Symfony\Component\Routing\Exception\MethodNotAllowedException;
 
 OC::$router->useCollection('ocs');
 OC::$router->loadRoutes();
@@ -31,4 +32,6 @@ try {
 	OC::$router->match($_SERVER['PATH_INFO']);
 } catch (ResourceNotFoundException $e) {
 	OC_OCS::notFound();
+} catch (MethodNotAllowedException $e) {
+	OC_Response::setStatus(405);
 }