CORS Headers

Laravel-cors is pre-configured in this repository.

If you don't need CORS headers, feel free to remove it.
Or if these headers are failing when your application encounters an error, you can fix it by removing this package and creating the following middleware:


namespace App\Http\Middleware;

use Closure;

class CorsMiddleware
     * Handle an incoming request.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
    public function handle($request, Closure $next)
        return $next($request);

    public function terminate($request, $response)
        return $response->header('Access-Control-Allow-Origin', '*')
        ->header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE')
        ->header('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With');