diff --git a/src/Laravel/Middleware/Cors.php b/src/Laravel/Middleware/Cors.php index 880008f..f99eb23 100644 --- a/src/Laravel/Middleware/Cors.php +++ b/src/Laravel/Middleware/Cors.php @@ -66,6 +66,9 @@ public function handle($request, Closure $next) } elseif ($this->cors->isPreflightRequest($type, $request)) { $this->corsHandle($request, $response = new Response()); + // Set Preflight response status code. + $response->setStatusCode(204); + return $response; // Add the headers on the Request Handled event as fallback in case of exceptions diff --git a/src/Lumen/Middleware/Cors.php b/src/Lumen/Middleware/Cors.php index 64c14dd..338c102 100644 --- a/src/Lumen/Middleware/Cors.php +++ b/src/Lumen/Middleware/Cors.php @@ -47,6 +47,9 @@ public function handle($request, Closure $next) $this->cors->setResponse($type, $response = new Response()); $this->cors->handle(); + // Set Preflight response status code. + $response->setStatusCode(204); + return $response; }