Skip to content

Instantly share code, notes, and snippets.

@plowzzer
Created September 24, 2020 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plowzzer/e1726a966cbd4922d308ccdbfed9913f to your computer and use it in GitHub Desktop.
Save plowzzer/e1726a966cbd4922d308ccdbfed9913f to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Middleware;
use Closure;
class Cors
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request)
->header('Access-Control-Allow-Origin', "*")
->header('Access-Control-Allow-Methods', "PUT, POST, DELETE, GET, OPTIONS")
->header('Access-Control-Allow-Headers', "Accept, Authorization, Content-Type");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment