Skip to content

Instantly share code, notes, and snippets.

@amouillard
Created November 19, 2016 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amouillard/61f5f3bc88e19ea5024754085f35c043 to your computer and use it in GitHub Desktop.
Save amouillard/61f5f3bc88e19ea5024754085f35c043 to your computer and use it in GitHub Desktop.
CORS middleware for Laravel 5.3
<?php
namespace App\Http\Middleware;
use Closure;
class Cors
{
public function handle($request, Closure $next)
{
return $next($request)
->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods', '*')
->header('Access-Control-Expose-Headers', 'authorization');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment