Answers for "Laravel SPA cors"

PHP
1

what is cors in laravel

Cross-Origin Resource Sharing
sharing resources between different sources
Posted by: Guest on October-11-2021
0

laravel-cors

composer require fruitcake/laravel-cors
Posted by: Guest on January-11-2021
0

Laravel SPA cors

// add a middleware  (php artisan make:middleware Cors)
// add in your kernel (\App\Http\Middleware\Cors::class,)
public function handle(Request $request, Closure $next)
{
  return $next($request)->header('Access-Control-Allow-Origin', '*')
  ->header('Access-Control-Allow-Methods','GET, POST, PUT, PATCH, DELETE, OPTIONS')
  ->header('Access-Control-Allow-Headers','Origin, X-Requested-With, Content-Type, Accept, Authorization');
}
Posted by: Guest on July-23-2021

Browse Popular Code Answers by Language