In Laravel Lumen 5.1 i am using this in my CorsMiddleware:
public function handle($request, \Closure $next)
{
$response = $next($request);
$response->header('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, PATCH, DELETE');
$response->header('Access-Control-Allow-Headers', $request->header('Access-Control-Request-Headers'));
$response->header('Access-Control-Allow-Origin', '*');
return $response;
}
But in 5.2 its not working anymore.
How do i return the appropriate headers in the response?
Put all your routes inside to enable web middleware group:
Upd.
To resolve this, please use this package: github.com/barryvdh/laravel-cors