解决laravel ~5.1 版本跨域问题

$response = $next($request);

$response->header('Access-Control-Allow-Origin', '*');

$response->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Cookie,X-CSRF-TOKEN, Accept,Authorization');

$response->header('Access-Control-Expose-Headers', 'Authorization,authenticated');

$response->header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, OPTIONS');

$response->header('Access-Control-Allow-Credentials', 'true');

return $response;

你可能感兴趣的:(解决laravel ~5.1 版本跨域问题)