diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 1a49d6f..03fd936 100755 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -2,7 +2,6 @@ namespace App\Http; -use Fruitcake\Cors\HandleCors; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel @@ -15,7 +14,7 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ - \App\Http\Middleware\CORS::class, + \Illuminate\Http\Middleware\HandleCors::class, \App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, diff --git a/app/Http/Middleware/CORS.php b/app/Http/Middleware/CORS.php deleted file mode 100755 index dd4d59f..0000000 --- a/app/Http/Middleware/CORS.php +++ /dev/null @@ -1,27 +0,0 @@ -header('origin'); - if (empty($origin)) { - $referer = $request->header('referer'); - if (!empty($referer) && preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)) { - $origin = $matches[0]; - } - } - $response = $next($request); - $response->header('Access-Control-Allow-Origin', preg_replace('~(?:^/|/$)~', '', "/".$origin)); - $response->header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS,HEAD'); - $response->header('Access-Control-Allow-Headers', 'Origin,Content-Type,Accept,Authorization,X-Request-With'); - $response->header('Access-Control-Allow-Credentials', 'true'); - $response->header('Access-Control-Max-Age', 10080); - - return $response; - } -}